diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 92dca37ea5e96..9efb64ac98e12 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -222,6 +222,7 @@ com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-resourcegraph;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-changeanalysis;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-delegatednetwork;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-sql-generated;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 7989569b6c22e..588ecc239903e 100644 --- a/pom.xml +++ b/pom.xml @@ -709,6 +709,7 @@ sdk/search sdk/servicebus sdk/spring + sdk/sql sdk/sqlvirtualmachine sdk/storage sdk/storagecache diff --git a/sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md b/sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md new file mode 100644 index 0000000000000..63781fb506500 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-04-06) + +- Azure Resource Manager Sql client library for Java. This package contains Microsoft Azure SDK for Sql Management SDK. The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. Package tag package-composite-v4. 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/sql/azure-resourcemanager-sql-generated/README.md b/sdk/sql/azure-resourcemanager-sql-generated/README.md new file mode 100644 index 0000000000000..2be94d1ed1e01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Sql client library for Java + +Azure Resource Manager Sql client library for Java. + +This package contains Microsoft Azure SDK for Sql Management SDK. The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. Package tag package-composite-v4. 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-sql-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-sql-generated + 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(); +SqlManager manager = SqlManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/sql/azure-resourcemanager-sql-generated/pom.xml b/sdk/sql/azure-resourcemanager-sql-generated/pom.xml new file mode 100644 index 0000000000000..8fc45fa718ead --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-sql-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Sql Management + This package contains Microsoft Azure SDK for Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. Package tag package-composite-v4. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.15.0 + + + com.azure + azure-core-management + 1.2.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java new file mode 100644 index 0000000000000..d6d42d71e3b48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java @@ -0,0 +1,1421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlManagementClient; +import com.azure.resourcemanager.sql.generated.implementation.BackupShortTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.CapabilitiesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DataMaskingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DataMaskingRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseAutomaticTuningsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseThreatDetectionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseUsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseVulnerabilityAssessmentRuleBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolActivitiesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolDatabaseActivitiesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolsImpl; +import com.azure.resourcemanager.sql.generated.implementation.EncryptionProtectorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ExtendedDatabaseBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ExtendedServerBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.FailoverGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.GeoBackupPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ImportExportsImpl; +import com.azure.resourcemanager.sql.generated.implementation.InstanceFailoverGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.InstancePoolsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobAgentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobCredentialsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobExecutionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobStepExecutionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobStepsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobTargetExecutionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobTargetGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobVersionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobsImpl; +import com.azure.resourcemanager.sql.generated.implementation.LongTermRetentionBackupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.LongTermRetentionManagedInstanceBackupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.LongTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedBackupShortTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseRestoreDetailsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceAdministratorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceAzureADOnlyAuthenticationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceEncryptionProtectorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceKeysImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceLongTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceTdeCertificatesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstancesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedServerSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RecommendedElasticPoolsImpl; +import com.azure.resourcemanager.sql.generated.implementation.RecoverableDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RecoverableManagedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ReplicationLinksImpl; +import com.azure.resourcemanager.sql.generated.implementation.RestorableDroppedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RestorableDroppedManagedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RestorePointsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAutomaticTuningsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAzureADAdministratorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAzureADOnlyAuthenticationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerCommunicationLinksImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerConnectionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerDevOpsAuditSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerDnsAliasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerKeysImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerTrustGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerUsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServersImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServiceObjectivesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServiceTierAdvisorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlManagementClientBuilder; +import com.azure.resourcemanager.sql.generated.implementation.SubscriptionUsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.SyncAgentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SyncGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SyncMembersImpl; +import com.azure.resourcemanager.sql.generated.implementation.TdeCertificatesImpl; +import com.azure.resourcemanager.sql.generated.implementation.TransparentDataEncryptionActivitiesImpl; +import com.azure.resourcemanager.sql.generated.implementation.TransparentDataEncryptionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.UsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.VirtualClustersImpl; +import com.azure.resourcemanager.sql.generated.implementation.VirtualNetworkRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.WorkloadClassifiersImpl; +import com.azure.resourcemanager.sql.generated.implementation.WorkloadGroupsImpl; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.Capabilities; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicies; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRules; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTunings; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperations; +import com.azure.resourcemanager.sql.generated.models.DatabaseThreatDetectionPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsages; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.Databases; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperations; +import com.azure.resourcemanager.sql.generated.models.ElasticPools; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectors; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.FailoverGroups; +import com.azure.resourcemanager.sql.generated.models.FirewallRules; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicies; +import com.azure.resourcemanager.sql.generated.models.ImportExports; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroups; +import com.azure.resourcemanager.sql.generated.models.InstancePools; +import com.azure.resourcemanager.sql.generated.models.JobAgents; +import com.azure.resourcemanager.sql.generated.models.JobCredentials; +import com.azure.resourcemanager.sql.generated.models.JobExecutions; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutions; +import com.azure.resourcemanager.sql.generated.models.JobSteps; +import com.azure.resourcemanager.sql.generated.models.JobTargetExecutions; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroups; +import com.azure.resourcemanager.sql.generated.models.JobVersions; +import com.azure.resourcemanager.sql.generated.models.Jobs; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackups; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionManagedInstanceBackups; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetails; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabases; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrators; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentications; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtectors; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKeys; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperations; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceTdeCertificates; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.ManagedInstances; +import com.azure.resourcemanager.sql.generated.models.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.Operations; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnections; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResources; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPools; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabases; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabases; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinks; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabases; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabases; +import com.azure.resourcemanager.sql.generated.models.RestorePoints; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTunings; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrators; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentications; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLinks; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditSettings; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliases; +import com.azure.resourcemanager.sql.generated.models.ServerKeys; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroups; +import com.azure.resourcemanager.sql.generated.models.ServerUsages; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.Servers; +import com.azure.resourcemanager.sql.generated.models.ServiceObjectives; +import com.azure.resourcemanager.sql.generated.models.ServiceTierAdvisors; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsages; +import com.azure.resourcemanager.sql.generated.models.SyncAgents; +import com.azure.resourcemanager.sql.generated.models.SyncGroups; +import com.azure.resourcemanager.sql.generated.models.SyncMembers; +import com.azure.resourcemanager.sql.generated.models.TdeCertificates; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionActivities; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptions; +import com.azure.resourcemanager.sql.generated.models.Usages; +import com.azure.resourcemanager.sql.generated.models.VirtualClusters; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRules; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifiers; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroups; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to SqlManager. The Azure SQL Database management API provides a RESTful set of web services that interact + * with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and + * delete databases. + */ +public final class SqlManager { + private RecoverableDatabases recoverableDatabases; + + private RestorableDroppedDatabases restorableDroppedDatabases; + + private ServerConnectionPolicies serverConnectionPolicies; + + private DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies; + + private DataMaskingPolicies dataMaskingPolicies; + + private DataMaskingRules dataMaskingRules; + + private FirewallRules firewallRules; + + private GeoBackupPolicies geoBackupPolicies; + + private Databases databases; + + private ElasticPools elasticPools; + + private RecommendedElasticPools recommendedElasticPools; + + private ReplicationLinks replicationLinks; + + private ServerCommunicationLinks serverCommunicationLinks; + + private ServiceObjectives serviceObjectives; + + private ElasticPoolActivities elasticPoolActivities; + + private ElasticPoolDatabaseActivities elasticPoolDatabaseActivities; + + private ServiceTierAdvisors serviceTierAdvisors; + + private TransparentDataEncryptions transparentDataEncryptions; + + private TransparentDataEncryptionActivities transparentDataEncryptionActivities; + + private ServerUsages serverUsages; + + private DatabaseUsages databaseUsages; + + private DatabaseAutomaticTunings databaseAutomaticTunings; + + private EncryptionProtectors encryptionProtectors; + + private FailoverGroups failoverGroups; + + private Operations operations; + + private ServerKeys serverKeys; + + private SyncAgents syncAgents; + + private SubscriptionUsages subscriptionUsages; + + private VirtualClusters virtualClusters; + + private VirtualNetworkRules virtualNetworkRules; + + private ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies; + + private ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies; + + private ServerBlobAuditingPolicies serverBlobAuditingPolicies; + + private DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies; + + private DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines; + + private DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments; + + private JobAgents jobAgents; + + private JobCredentials jobCredentials; + + private JobExecutions jobExecutions; + + private Jobs jobs; + + private JobStepExecutions jobStepExecutions; + + private JobSteps jobSteps; + + private JobTargetExecutions jobTargetExecutions; + + private JobTargetGroups jobTargetGroups; + + private JobVersions jobVersions; + + private ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies; + + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies + managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + + private ServerAutomaticTunings serverAutomaticTunings; + + private ServerDnsAliases serverDnsAliases; + + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + + private RestorableDroppedManagedDatabases restorableDroppedManagedDatabases; + + private RestorePoints restorePoints; + + private ManagedDatabaseSecurityAlertPolicies managedDatabaseSecurityAlertPolicies; + + private ManagedServerSecurityAlertPolicies managedServerSecurityAlertPolicies; + + private SensitivityLabels sensitivityLabels; + + private ManagedInstanceAdministrators managedInstanceAdministrators; + + private DatabaseOperations databaseOperations; + + private ElasticPoolOperations elasticPoolOperations; + + private DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans; + + private ManagedDatabaseVulnerabilityAssessmentRuleBaselines managedDatabaseVulnerabilityAssessmentRuleBaselines; + + private ManagedDatabaseVulnerabilityAssessmentScans managedDatabaseVulnerabilityAssessmentScans; + + private ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments; + + private InstanceFailoverGroups instanceFailoverGroups; + + private TdeCertificates tdeCertificates; + + private ManagedInstanceTdeCertificates managedInstanceTdeCertificates; + + private ManagedInstanceKeys managedInstanceKeys; + + private ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors; + + private RecoverableManagedDatabases recoverableManagedDatabases; + + private BackupShortTermRetentionPolicies backupShortTermRetentionPolicies; + + private ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments; + + private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + + private ManagedDatabaseSensitivityLabels managedDatabaseSensitivityLabels; + + private InstancePools instancePools; + + private Usages usages; + + private PrivateLinkResources privateLinkResources; + + private Servers servers; + + private Capabilities capabilities; + + private LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups; + + private ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies; + + private WorkloadGroups workloadGroups; + + private WorkloadClassifiers workloadClassifiers; + + private ManagedInstanceOperations managedInstanceOperations; + + private ServerAzureADAdministrators serverAzureADAdministrators; + + private SyncGroups syncGroups; + + private SyncMembers syncMembers; + + private ImportExports importExports; + + private ManagedDatabases managedDatabases; + + private ManagedDatabaseRestoreDetails managedDatabaseRestoreDetails; + + private ServerAzureADOnlyAuthentications serverAzureADOnlyAuthentications; + + private ManagedInstances managedInstances; + + private ManagedInstanceAzureADOnlyAuthentications managedInstanceAzureADOnlyAuthentications; + + private ServerTrustGroups serverTrustGroups; + + private ServerDevOpsAuditSettings serverDevOpsAuditSettings; + + private LongTermRetentionBackups longTermRetentionBackups; + + private LongTermRetentionPolicies longTermRetentionPolicies; + + private PrivateEndpointConnections privateEndpointConnections; + + private final SqlManagementClient clientObject; + + private SqlManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new SqlManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Sql service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Sql service API instance. + */ + public static SqlManager 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 SqlManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SqlManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Sql service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Sql service API instance. + */ + public SqlManager 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.sql.generated") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new SqlManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of RecoverableDatabases. */ + public RecoverableDatabases recoverableDatabases() { + if (this.recoverableDatabases == null) { + this.recoverableDatabases = new RecoverableDatabasesImpl(clientObject.getRecoverableDatabases(), this); + } + return recoverableDatabases; + } + + /** @return Resource collection API of RestorableDroppedDatabases. */ + public RestorableDroppedDatabases restorableDroppedDatabases() { + if (this.restorableDroppedDatabases == null) { + this.restorableDroppedDatabases = + new RestorableDroppedDatabasesImpl(clientObject.getRestorableDroppedDatabases(), this); + } + return restorableDroppedDatabases; + } + + /** @return Resource collection API of ServerConnectionPolicies. */ + public ServerConnectionPolicies serverConnectionPolicies() { + if (this.serverConnectionPolicies == null) { + this.serverConnectionPolicies = + new ServerConnectionPoliciesImpl(clientObject.getServerConnectionPolicies(), this); + } + return serverConnectionPolicies; + } + + /** @return Resource collection API of DatabaseThreatDetectionPolicies. */ + public DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies() { + if (this.databaseThreatDetectionPolicies == null) { + this.databaseThreatDetectionPolicies = + new DatabaseThreatDetectionPoliciesImpl(clientObject.getDatabaseThreatDetectionPolicies(), this); + } + return databaseThreatDetectionPolicies; + } + + /** @return Resource collection API of DataMaskingPolicies. */ + public DataMaskingPolicies dataMaskingPolicies() { + if (this.dataMaskingPolicies == null) { + this.dataMaskingPolicies = new DataMaskingPoliciesImpl(clientObject.getDataMaskingPolicies(), this); + } + return dataMaskingPolicies; + } + + /** @return Resource collection API of DataMaskingRules. */ + public DataMaskingRules dataMaskingRules() { + if (this.dataMaskingRules == null) { + this.dataMaskingRules = new DataMaskingRulesImpl(clientObject.getDataMaskingRules(), this); + } + return dataMaskingRules; + } + + /** @return Resource collection API of FirewallRules. */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** @return Resource collection API of GeoBackupPolicies. */ + public GeoBackupPolicies geoBackupPolicies() { + if (this.geoBackupPolicies == null) { + this.geoBackupPolicies = new GeoBackupPoliciesImpl(clientObject.getGeoBackupPolicies(), this); + } + return geoBackupPolicies; + } + + /** @return Resource collection API of Databases. */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + } + return databases; + } + + /** @return Resource collection API of ElasticPools. */ + public ElasticPools elasticPools() { + if (this.elasticPools == null) { + this.elasticPools = new ElasticPoolsImpl(clientObject.getElasticPools(), this); + } + return elasticPools; + } + + /** @return Resource collection API of RecommendedElasticPools. */ + public RecommendedElasticPools recommendedElasticPools() { + if (this.recommendedElasticPools == null) { + this.recommendedElasticPools = + new RecommendedElasticPoolsImpl(clientObject.getRecommendedElasticPools(), this); + } + return recommendedElasticPools; + } + + /** @return Resource collection API of ReplicationLinks. */ + public ReplicationLinks replicationLinks() { + if (this.replicationLinks == null) { + this.replicationLinks = new ReplicationLinksImpl(clientObject.getReplicationLinks(), this); + } + return replicationLinks; + } + + /** @return Resource collection API of ServerCommunicationLinks. */ + public ServerCommunicationLinks serverCommunicationLinks() { + if (this.serverCommunicationLinks == null) { + this.serverCommunicationLinks = + new ServerCommunicationLinksImpl(clientObject.getServerCommunicationLinks(), this); + } + return serverCommunicationLinks; + } + + /** @return Resource collection API of ServiceObjectives. */ + public ServiceObjectives serviceObjectives() { + if (this.serviceObjectives == null) { + this.serviceObjectives = new ServiceObjectivesImpl(clientObject.getServiceObjectives(), this); + } + return serviceObjectives; + } + + /** @return Resource collection API of ElasticPoolActivities. */ + public ElasticPoolActivities elasticPoolActivities() { + if (this.elasticPoolActivities == null) { + this.elasticPoolActivities = new ElasticPoolActivitiesImpl(clientObject.getElasticPoolActivities(), this); + } + return elasticPoolActivities; + } + + /** @return Resource collection API of ElasticPoolDatabaseActivities. */ + public ElasticPoolDatabaseActivities elasticPoolDatabaseActivities() { + if (this.elasticPoolDatabaseActivities == null) { + this.elasticPoolDatabaseActivities = + new ElasticPoolDatabaseActivitiesImpl(clientObject.getElasticPoolDatabaseActivities(), this); + } + return elasticPoolDatabaseActivities; + } + + /** @return Resource collection API of ServiceTierAdvisors. */ + public ServiceTierAdvisors serviceTierAdvisors() { + if (this.serviceTierAdvisors == null) { + this.serviceTierAdvisors = new ServiceTierAdvisorsImpl(clientObject.getServiceTierAdvisors(), this); + } + return serviceTierAdvisors; + } + + /** @return Resource collection API of TransparentDataEncryptions. */ + public TransparentDataEncryptions transparentDataEncryptions() { + if (this.transparentDataEncryptions == null) { + this.transparentDataEncryptions = + new TransparentDataEncryptionsImpl(clientObject.getTransparentDataEncryptions(), this); + } + return transparentDataEncryptions; + } + + /** @return Resource collection API of TransparentDataEncryptionActivities. */ + public TransparentDataEncryptionActivities transparentDataEncryptionActivities() { + if (this.transparentDataEncryptionActivities == null) { + this.transparentDataEncryptionActivities = + new TransparentDataEncryptionActivitiesImpl( + clientObject.getTransparentDataEncryptionActivities(), this); + } + return transparentDataEncryptionActivities; + } + + /** @return Resource collection API of ServerUsages. */ + public ServerUsages serverUsages() { + if (this.serverUsages == null) { + this.serverUsages = new ServerUsagesImpl(clientObject.getServerUsages(), this); + } + return serverUsages; + } + + /** @return Resource collection API of DatabaseUsages. */ + public DatabaseUsages databaseUsages() { + if (this.databaseUsages == null) { + this.databaseUsages = new DatabaseUsagesImpl(clientObject.getDatabaseUsages(), this); + } + return databaseUsages; + } + + /** @return Resource collection API of DatabaseAutomaticTunings. */ + public DatabaseAutomaticTunings databaseAutomaticTunings() { + if (this.databaseAutomaticTunings == null) { + this.databaseAutomaticTunings = + new DatabaseAutomaticTuningsImpl(clientObject.getDatabaseAutomaticTunings(), this); + } + return databaseAutomaticTunings; + } + + /** @return Resource collection API of EncryptionProtectors. */ + public EncryptionProtectors encryptionProtectors() { + if (this.encryptionProtectors == null) { + this.encryptionProtectors = new EncryptionProtectorsImpl(clientObject.getEncryptionProtectors(), this); + } + return encryptionProtectors; + } + + /** @return Resource collection API of FailoverGroups. */ + public FailoverGroups failoverGroups() { + if (this.failoverGroups == null) { + this.failoverGroups = new FailoverGroupsImpl(clientObject.getFailoverGroups(), this); + } + return failoverGroups; + } + + /** @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 ServerKeys. */ + public ServerKeys serverKeys() { + if (this.serverKeys == null) { + this.serverKeys = new ServerKeysImpl(clientObject.getServerKeys(), this); + } + return serverKeys; + } + + /** @return Resource collection API of SyncAgents. */ + public SyncAgents syncAgents() { + if (this.syncAgents == null) { + this.syncAgents = new SyncAgentsImpl(clientObject.getSyncAgents(), this); + } + return syncAgents; + } + + /** @return Resource collection API of SubscriptionUsages. */ + public SubscriptionUsages subscriptionUsages() { + if (this.subscriptionUsages == null) { + this.subscriptionUsages = new SubscriptionUsagesImpl(clientObject.getSubscriptionUsages(), this); + } + return subscriptionUsages; + } + + /** @return Resource collection API of VirtualClusters. */ + public VirtualClusters virtualClusters() { + if (this.virtualClusters == null) { + this.virtualClusters = new VirtualClustersImpl(clientObject.getVirtualClusters(), this); + } + return virtualClusters; + } + + /** @return Resource collection API of VirtualNetworkRules. */ + public VirtualNetworkRules virtualNetworkRules() { + if (this.virtualNetworkRules == null) { + this.virtualNetworkRules = new VirtualNetworkRulesImpl(clientObject.getVirtualNetworkRules(), this); + } + return virtualNetworkRules; + } + + /** @return Resource collection API of ExtendedDatabaseBlobAuditingPolicies. */ + public ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies() { + if (this.extendedDatabaseBlobAuditingPolicies == null) { + this.extendedDatabaseBlobAuditingPolicies = + new ExtendedDatabaseBlobAuditingPoliciesImpl( + clientObject.getExtendedDatabaseBlobAuditingPolicies(), this); + } + return extendedDatabaseBlobAuditingPolicies; + } + + /** @return Resource collection API of ExtendedServerBlobAuditingPolicies. */ + public ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies() { + if (this.extendedServerBlobAuditingPolicies == null) { + this.extendedServerBlobAuditingPolicies = + new ExtendedServerBlobAuditingPoliciesImpl(clientObject.getExtendedServerBlobAuditingPolicies(), this); + } + return extendedServerBlobAuditingPolicies; + } + + /** @return Resource collection API of ServerBlobAuditingPolicies. */ + public ServerBlobAuditingPolicies serverBlobAuditingPolicies() { + if (this.serverBlobAuditingPolicies == null) { + this.serverBlobAuditingPolicies = + new ServerBlobAuditingPoliciesImpl(clientObject.getServerBlobAuditingPolicies(), this); + } + return serverBlobAuditingPolicies; + } + + /** @return Resource collection API of DatabaseBlobAuditingPolicies. */ + public DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies() { + if (this.databaseBlobAuditingPolicies == null) { + this.databaseBlobAuditingPolicies = + new DatabaseBlobAuditingPoliciesImpl(clientObject.getDatabaseBlobAuditingPolicies(), this); + } + return databaseBlobAuditingPolicies; + } + + /** @return Resource collection API of DatabaseVulnerabilityAssessmentRuleBaselines. */ + public DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines() { + if (this.databaseVulnerabilityAssessmentRuleBaselines == null) { + this.databaseVulnerabilityAssessmentRuleBaselines = + new DatabaseVulnerabilityAssessmentRuleBaselinesImpl( + clientObject.getDatabaseVulnerabilityAssessmentRuleBaselines(), this); + } + return databaseVulnerabilityAssessmentRuleBaselines; + } + + /** @return Resource collection API of DatabaseVulnerabilityAssessments. */ + public DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments() { + if (this.databaseVulnerabilityAssessments == null) { + this.databaseVulnerabilityAssessments = + new DatabaseVulnerabilityAssessmentsImpl(clientObject.getDatabaseVulnerabilityAssessments(), this); + } + return databaseVulnerabilityAssessments; + } + + /** @return Resource collection API of JobAgents. */ + public JobAgents jobAgents() { + if (this.jobAgents == null) { + this.jobAgents = new JobAgentsImpl(clientObject.getJobAgents(), this); + } + return jobAgents; + } + + /** @return Resource collection API of JobCredentials. */ + public JobCredentials jobCredentials() { + if (this.jobCredentials == null) { + this.jobCredentials = new JobCredentialsImpl(clientObject.getJobCredentials(), this); + } + return jobCredentials; + } + + /** @return Resource collection API of JobExecutions. */ + public JobExecutions jobExecutions() { + if (this.jobExecutions == null) { + this.jobExecutions = new JobExecutionsImpl(clientObject.getJobExecutions(), this); + } + return jobExecutions; + } + + /** @return Resource collection API of Jobs. */ + public Jobs jobs() { + if (this.jobs == null) { + this.jobs = new JobsImpl(clientObject.getJobs(), this); + } + return jobs; + } + + /** @return Resource collection API of JobStepExecutions. */ + public JobStepExecutions jobStepExecutions() { + if (this.jobStepExecutions == null) { + this.jobStepExecutions = new JobStepExecutionsImpl(clientObject.getJobStepExecutions(), this); + } + return jobStepExecutions; + } + + /** @return Resource collection API of JobSteps. */ + public JobSteps jobSteps() { + if (this.jobSteps == null) { + this.jobSteps = new JobStepsImpl(clientObject.getJobSteps(), this); + } + return jobSteps; + } + + /** @return Resource collection API of JobTargetExecutions. */ + public JobTargetExecutions jobTargetExecutions() { + if (this.jobTargetExecutions == null) { + this.jobTargetExecutions = new JobTargetExecutionsImpl(clientObject.getJobTargetExecutions(), this); + } + return jobTargetExecutions; + } + + /** @return Resource collection API of JobTargetGroups. */ + public JobTargetGroups jobTargetGroups() { + if (this.jobTargetGroups == null) { + this.jobTargetGroups = new JobTargetGroupsImpl(clientObject.getJobTargetGroups(), this); + } + return jobTargetGroups; + } + + /** @return Resource collection API of JobVersions. */ + public JobVersions jobVersions() { + if (this.jobVersions == null) { + this.jobVersions = new JobVersionsImpl(clientObject.getJobVersions(), this); + } + return jobVersions; + } + + /** @return Resource collection API of ManagedBackupShortTermRetentionPolicies. */ + public ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies() { + if (this.managedBackupShortTermRetentionPolicies == null) { + this.managedBackupShortTermRetentionPolicies = + new ManagedBackupShortTermRetentionPoliciesImpl( + clientObject.getManagedBackupShortTermRetentionPolicies(), this); + } + return managedBackupShortTermRetentionPolicies; + } + + /** @return Resource collection API of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies + managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() { + if (this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies == null) { + this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = + new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl( + clientObject.getManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(), this); + } + return managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + } + + /** @return Resource collection API of ServerAutomaticTunings. */ + public ServerAutomaticTunings serverAutomaticTunings() { + if (this.serverAutomaticTunings == null) { + this.serverAutomaticTunings = + new ServerAutomaticTuningsImpl(clientObject.getServerAutomaticTunings(), this); + } + return serverAutomaticTunings; + } + + /** @return Resource collection API of ServerDnsAliases. */ + public ServerDnsAliases serverDnsAliases() { + if (this.serverDnsAliases == null) { + this.serverDnsAliases = new ServerDnsAliasesImpl(clientObject.getServerDnsAliases(), this); + } + return serverDnsAliases; + } + + /** @return Resource collection API of ServerSecurityAlertPolicies. */ + public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { + if (this.serverSecurityAlertPolicies == null) { + this.serverSecurityAlertPolicies = + new ServerSecurityAlertPoliciesImpl(clientObject.getServerSecurityAlertPolicies(), this); + } + return serverSecurityAlertPolicies; + } + + /** @return Resource collection API of RestorableDroppedManagedDatabases. */ + public RestorableDroppedManagedDatabases restorableDroppedManagedDatabases() { + if (this.restorableDroppedManagedDatabases == null) { + this.restorableDroppedManagedDatabases = + new RestorableDroppedManagedDatabasesImpl(clientObject.getRestorableDroppedManagedDatabases(), this); + } + return restorableDroppedManagedDatabases; + } + + /** @return Resource collection API of RestorePoints. */ + public RestorePoints restorePoints() { + if (this.restorePoints == null) { + this.restorePoints = new RestorePointsImpl(clientObject.getRestorePoints(), this); + } + return restorePoints; + } + + /** @return Resource collection API of ManagedDatabaseSecurityAlertPolicies. */ + public ManagedDatabaseSecurityAlertPolicies managedDatabaseSecurityAlertPolicies() { + if (this.managedDatabaseSecurityAlertPolicies == null) { + this.managedDatabaseSecurityAlertPolicies = + new ManagedDatabaseSecurityAlertPoliciesImpl( + clientObject.getManagedDatabaseSecurityAlertPolicies(), this); + } + return managedDatabaseSecurityAlertPolicies; + } + + /** @return Resource collection API of ManagedServerSecurityAlertPolicies. */ + public ManagedServerSecurityAlertPolicies managedServerSecurityAlertPolicies() { + if (this.managedServerSecurityAlertPolicies == null) { + this.managedServerSecurityAlertPolicies = + new ManagedServerSecurityAlertPoliciesImpl(clientObject.getManagedServerSecurityAlertPolicies(), this); + } + return managedServerSecurityAlertPolicies; + } + + /** @return Resource collection API of SensitivityLabels. */ + public SensitivityLabels sensitivityLabels() { + if (this.sensitivityLabels == null) { + this.sensitivityLabels = new SensitivityLabelsImpl(clientObject.getSensitivityLabels(), this); + } + return sensitivityLabels; + } + + /** @return Resource collection API of ManagedInstanceAdministrators. */ + public ManagedInstanceAdministrators managedInstanceAdministrators() { + if (this.managedInstanceAdministrators == null) { + this.managedInstanceAdministrators = + new ManagedInstanceAdministratorsImpl(clientObject.getManagedInstanceAdministrators(), this); + } + return managedInstanceAdministrators; + } + + /** @return Resource collection API of DatabaseOperations. */ + public DatabaseOperations databaseOperations() { + if (this.databaseOperations == null) { + this.databaseOperations = new DatabaseOperationsImpl(clientObject.getDatabaseOperations(), this); + } + return databaseOperations; + } + + /** @return Resource collection API of ElasticPoolOperations. */ + public ElasticPoolOperations elasticPoolOperations() { + if (this.elasticPoolOperations == null) { + this.elasticPoolOperations = new ElasticPoolOperationsImpl(clientObject.getElasticPoolOperations(), this); + } + return elasticPoolOperations; + } + + /** @return Resource collection API of DatabaseVulnerabilityAssessmentScans. */ + public DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans() { + if (this.databaseVulnerabilityAssessmentScans == null) { + this.databaseVulnerabilityAssessmentScans = + new DatabaseVulnerabilityAssessmentScansImpl( + clientObject.getDatabaseVulnerabilityAssessmentScans(), this); + } + return databaseVulnerabilityAssessmentScans; + } + + /** @return Resource collection API of ManagedDatabaseVulnerabilityAssessmentRuleBaselines. */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselines managedDatabaseVulnerabilityAssessmentRuleBaselines() { + if (this.managedDatabaseVulnerabilityAssessmentRuleBaselines == null) { + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = + new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl( + clientObject.getManagedDatabaseVulnerabilityAssessmentRuleBaselines(), this); + } + return managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** @return Resource collection API of ManagedDatabaseVulnerabilityAssessmentScans. */ + public ManagedDatabaseVulnerabilityAssessmentScans managedDatabaseVulnerabilityAssessmentScans() { + if (this.managedDatabaseVulnerabilityAssessmentScans == null) { + this.managedDatabaseVulnerabilityAssessmentScans = + new ManagedDatabaseVulnerabilityAssessmentScansImpl( + clientObject.getManagedDatabaseVulnerabilityAssessmentScans(), this); + } + return managedDatabaseVulnerabilityAssessmentScans; + } + + /** @return Resource collection API of ManagedDatabaseVulnerabilityAssessments. */ + public ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments() { + if (this.managedDatabaseVulnerabilityAssessments == null) { + this.managedDatabaseVulnerabilityAssessments = + new ManagedDatabaseVulnerabilityAssessmentsImpl( + clientObject.getManagedDatabaseVulnerabilityAssessments(), this); + } + return managedDatabaseVulnerabilityAssessments; + } + + /** @return Resource collection API of InstanceFailoverGroups. */ + public InstanceFailoverGroups instanceFailoverGroups() { + if (this.instanceFailoverGroups == null) { + this.instanceFailoverGroups = + new InstanceFailoverGroupsImpl(clientObject.getInstanceFailoverGroups(), this); + } + return instanceFailoverGroups; + } + + /** @return Resource collection API of TdeCertificates. */ + public TdeCertificates tdeCertificates() { + if (this.tdeCertificates == null) { + this.tdeCertificates = new TdeCertificatesImpl(clientObject.getTdeCertificates(), this); + } + return tdeCertificates; + } + + /** @return Resource collection API of ManagedInstanceTdeCertificates. */ + public ManagedInstanceTdeCertificates managedInstanceTdeCertificates() { + if (this.managedInstanceTdeCertificates == null) { + this.managedInstanceTdeCertificates = + new ManagedInstanceTdeCertificatesImpl(clientObject.getManagedInstanceTdeCertificates(), this); + } + return managedInstanceTdeCertificates; + } + + /** @return Resource collection API of ManagedInstanceKeys. */ + public ManagedInstanceKeys managedInstanceKeys() { + if (this.managedInstanceKeys == null) { + this.managedInstanceKeys = new ManagedInstanceKeysImpl(clientObject.getManagedInstanceKeys(), this); + } + return managedInstanceKeys; + } + + /** @return Resource collection API of ManagedInstanceEncryptionProtectors. */ + public ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors() { + if (this.managedInstanceEncryptionProtectors == null) { + this.managedInstanceEncryptionProtectors = + new ManagedInstanceEncryptionProtectorsImpl( + clientObject.getManagedInstanceEncryptionProtectors(), this); + } + return managedInstanceEncryptionProtectors; + } + + /** @return Resource collection API of RecoverableManagedDatabases. */ + public RecoverableManagedDatabases recoverableManagedDatabases() { + if (this.recoverableManagedDatabases == null) { + this.recoverableManagedDatabases = + new RecoverableManagedDatabasesImpl(clientObject.getRecoverableManagedDatabases(), this); + } + return recoverableManagedDatabases; + } + + /** @return Resource collection API of BackupShortTermRetentionPolicies. */ + public BackupShortTermRetentionPolicies backupShortTermRetentionPolicies() { + if (this.backupShortTermRetentionPolicies == null) { + this.backupShortTermRetentionPolicies = + new BackupShortTermRetentionPoliciesImpl(clientObject.getBackupShortTermRetentionPolicies(), this); + } + return backupShortTermRetentionPolicies; + } + + /** @return Resource collection API of ManagedInstanceVulnerabilityAssessments. */ + public ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments() { + if (this.managedInstanceVulnerabilityAssessments == null) { + this.managedInstanceVulnerabilityAssessments = + new ManagedInstanceVulnerabilityAssessmentsImpl( + clientObject.getManagedInstanceVulnerabilityAssessments(), this); + } + return managedInstanceVulnerabilityAssessments; + } + + /** @return Resource collection API of ServerVulnerabilityAssessments. */ + public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { + if (this.serverVulnerabilityAssessments == null) { + this.serverVulnerabilityAssessments = + new ServerVulnerabilityAssessmentsImpl(clientObject.getServerVulnerabilityAssessments(), this); + } + return serverVulnerabilityAssessments; + } + + /** @return Resource collection API of ManagedDatabaseSensitivityLabels. */ + public ManagedDatabaseSensitivityLabels managedDatabaseSensitivityLabels() { + if (this.managedDatabaseSensitivityLabels == null) { + this.managedDatabaseSensitivityLabels = + new ManagedDatabaseSensitivityLabelsImpl(clientObject.getManagedDatabaseSensitivityLabels(), this); + } + return managedDatabaseSensitivityLabels; + } + + /** @return Resource collection API of InstancePools. */ + public InstancePools instancePools() { + if (this.instancePools == null) { + this.instancePools = new InstancePoolsImpl(clientObject.getInstancePools(), this); + } + return instancePools; + } + + /** @return Resource collection API of Usages. */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(clientObject.getUsages(), this); + } + return usages; + } + + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @return Resource collection API of Servers. */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(clientObject.getServers(), this); + } + return servers; + } + + /** @return Resource collection API of Capabilities. */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(clientObject.getCapabilities(), this); + } + return capabilities; + } + + /** @return Resource collection API of LongTermRetentionManagedInstanceBackups. */ + public LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups() { + if (this.longTermRetentionManagedInstanceBackups == null) { + this.longTermRetentionManagedInstanceBackups = + new LongTermRetentionManagedInstanceBackupsImpl( + clientObject.getLongTermRetentionManagedInstanceBackups(), this); + } + return longTermRetentionManagedInstanceBackups; + } + + /** @return Resource collection API of ManagedInstanceLongTermRetentionPolicies. */ + public ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies() { + if (this.managedInstanceLongTermRetentionPolicies == null) { + this.managedInstanceLongTermRetentionPolicies = + new ManagedInstanceLongTermRetentionPoliciesImpl( + clientObject.getManagedInstanceLongTermRetentionPolicies(), this); + } + return managedInstanceLongTermRetentionPolicies; + } + + /** @return Resource collection API of WorkloadGroups. */ + public WorkloadGroups workloadGroups() { + if (this.workloadGroups == null) { + this.workloadGroups = new WorkloadGroupsImpl(clientObject.getWorkloadGroups(), this); + } + return workloadGroups; + } + + /** @return Resource collection API of WorkloadClassifiers. */ + public WorkloadClassifiers workloadClassifiers() { + if (this.workloadClassifiers == null) { + this.workloadClassifiers = new WorkloadClassifiersImpl(clientObject.getWorkloadClassifiers(), this); + } + return workloadClassifiers; + } + + /** @return Resource collection API of ManagedInstanceOperations. */ + public ManagedInstanceOperations managedInstanceOperations() { + if (this.managedInstanceOperations == null) { + this.managedInstanceOperations = + new ManagedInstanceOperationsImpl(clientObject.getManagedInstanceOperations(), this); + } + return managedInstanceOperations; + } + + /** @return Resource collection API of ServerAzureADAdministrators. */ + public ServerAzureADAdministrators serverAzureADAdministrators() { + if (this.serverAzureADAdministrators == null) { + this.serverAzureADAdministrators = + new ServerAzureADAdministratorsImpl(clientObject.getServerAzureADAdministrators(), this); + } + return serverAzureADAdministrators; + } + + /** @return Resource collection API of SyncGroups. */ + public SyncGroups syncGroups() { + if (this.syncGroups == null) { + this.syncGroups = new SyncGroupsImpl(clientObject.getSyncGroups(), this); + } + return syncGroups; + } + + /** @return Resource collection API of SyncMembers. */ + public SyncMembers syncMembers() { + if (this.syncMembers == null) { + this.syncMembers = new SyncMembersImpl(clientObject.getSyncMembers(), this); + } + return syncMembers; + } + + /** @return Resource collection API of ImportExports. */ + public ImportExports importExports() { + if (this.importExports == null) { + this.importExports = new ImportExportsImpl(clientObject.getImportExports(), this); + } + return importExports; + } + + /** @return Resource collection API of ManagedDatabases. */ + public ManagedDatabases managedDatabases() { + if (this.managedDatabases == null) { + this.managedDatabases = new ManagedDatabasesImpl(clientObject.getManagedDatabases(), this); + } + return managedDatabases; + } + + /** @return Resource collection API of ManagedDatabaseRestoreDetails. */ + public ManagedDatabaseRestoreDetails managedDatabaseRestoreDetails() { + if (this.managedDatabaseRestoreDetails == null) { + this.managedDatabaseRestoreDetails = + new ManagedDatabaseRestoreDetailsImpl(clientObject.getManagedDatabaseRestoreDetails(), this); + } + return managedDatabaseRestoreDetails; + } + + /** @return Resource collection API of ServerAzureADOnlyAuthentications. */ + public ServerAzureADOnlyAuthentications serverAzureADOnlyAuthentications() { + if (this.serverAzureADOnlyAuthentications == null) { + this.serverAzureADOnlyAuthentications = + new ServerAzureADOnlyAuthenticationsImpl(clientObject.getServerAzureADOnlyAuthentications(), this); + } + return serverAzureADOnlyAuthentications; + } + + /** @return Resource collection API of ManagedInstances. */ + public ManagedInstances managedInstances() { + if (this.managedInstances == null) { + this.managedInstances = new ManagedInstancesImpl(clientObject.getManagedInstances(), this); + } + return managedInstances; + } + + /** @return Resource collection API of ManagedInstanceAzureADOnlyAuthentications. */ + public ManagedInstanceAzureADOnlyAuthentications managedInstanceAzureADOnlyAuthentications() { + if (this.managedInstanceAzureADOnlyAuthentications == null) { + this.managedInstanceAzureADOnlyAuthentications = + new ManagedInstanceAzureADOnlyAuthenticationsImpl( + clientObject.getManagedInstanceAzureADOnlyAuthentications(), this); + } + return managedInstanceAzureADOnlyAuthentications; + } + + /** @return Resource collection API of ServerTrustGroups. */ + public ServerTrustGroups serverTrustGroups() { + if (this.serverTrustGroups == null) { + this.serverTrustGroups = new ServerTrustGroupsImpl(clientObject.getServerTrustGroups(), this); + } + return serverTrustGroups; + } + + /** @return Resource collection API of ServerDevOpsAuditSettings. */ + public ServerDevOpsAuditSettings serverDevOpsAuditSettings() { + if (this.serverDevOpsAuditSettings == null) { + this.serverDevOpsAuditSettings = + new ServerDevOpsAuditSettingsImpl(clientObject.getServerDevOpsAuditSettings(), this); + } + return serverDevOpsAuditSettings; + } + + /** @return Resource collection API of LongTermRetentionBackups. */ + public LongTermRetentionBackups longTermRetentionBackups() { + if (this.longTermRetentionBackups == null) { + this.longTermRetentionBackups = + new LongTermRetentionBackupsImpl(clientObject.getLongTermRetentionBackups(), this); + } + return longTermRetentionBackups; + } + + /** @return Resource collection API of LongTermRetentionPolicies. */ + public LongTermRetentionPolicies longTermRetentionPolicies() { + if (this.longTermRetentionPolicies == null) { + this.longTermRetentionPolicies = + new LongTermRetentionPoliciesImpl(clientObject.getLongTermRetentionPolicies(), this); + } + return longTermRetentionPolicies; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * @return Wrapped service client SqlManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public SqlManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/BackupShortTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/BackupShortTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..b9ed9834b0642 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/BackupShortTermRetentionPoliciesClient.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in BackupShortTermRetentionPoliciesClient. + */ +public interface BackupShortTermRetentionPoliciesClient { + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName); + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/CapabilitiesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/CapabilitiesClient.java new file mode 100644 index 0000000000000..6bf4b18d0a3d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/CapabilitiesClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.CapabilityGroup; + +/** An instance of this class provides access to all the operations defined in CapabilitiesClient. */ +public interface CapabilitiesClient { + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LocationCapabilitiesInner listByLocation(String locationName); + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. + * @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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingPoliciesClient.java new file mode 100644 index 0000000000000..92445c9500760 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingPoliciesClient.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.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; + +/** An instance of this class provides access to all the operations defined in DataMaskingPoliciesClient. */ +public interface DataMaskingPoliciesClient { + /** + * Creates or updates a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters Parameters for creating or updating a data masking policy. + * @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 represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataMaskingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters); + + /** + * Creates or updates a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters Parameters for creating or updating a data masking policy. + * @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 represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataMaskingPolicyInner parameters, + Context context); + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataMaskingPolicyInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingRulesClient.java new file mode 100644 index 0000000000000..bcb930f2c7316 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingRulesClient.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.DataMaskingRuleInner; + +/** An instance of this class provides access to all the operations defined in DataMaskingRulesClient. */ +public interface DataMaskingRulesClient { + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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 represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataMaskingRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters); + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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 represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters, + Context context); + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAutomaticTuningsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAutomaticTuningsClient.java new file mode 100644 index 0000000000000..f5a7bedd72e30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAutomaticTuningsClient.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.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; + +/** An instance of this class provides access to all the operations defined in DatabaseAutomaticTuningsClient. */ +public interface DatabaseAutomaticTuningsClient { + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAutomaticTuningInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @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 database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAutomaticTuningInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters); + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @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 database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..2e963196db63d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseBlobAuditingPoliciesClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; + +/** An instance of this class provides access to all the operations defined in DatabaseBlobAuditingPoliciesClient. */ +public interface DatabaseBlobAuditingPoliciesClient { + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Creates or updates a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database blob auditing policy. + * @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 database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters); + + /** + * Creates or updates a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database blob auditing policy. + * @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 database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseBlobAuditingPolicyInner parameters, + Context context); + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseOperationsClient.java new file mode 100644 index 0000000000000..395ffaed5a486 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseOperationsClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.DatabaseOperationInner; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in DatabaseOperationsClient. */ +public interface DatabaseOperationsClient { + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId); + + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @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 cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context); + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseThreatDetectionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseThreatDetectionPoliciesClient.java new file mode 100644 index 0000000000000..345dc36c5686a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseThreatDetectionPoliciesClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** An instance of this class provides access to all the operations defined in DatabaseThreatDetectionPoliciesClient. */ +public interface DatabaseThreatDetectionPoliciesClient { + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 database's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 database's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * Creates or updates a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database Threat Detection policy. + * @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 contains information about a database Threat Detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database Threat Detection policy. + * @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 contains information about a database Threat Detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseUsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseUsagesClient.java new file mode 100644 index 0000000000000..d409d9038613e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseUsagesClient.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.sql.generated.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.sql.generated.fluent.models.DatabaseUsageInner; + +/** An instance of this class provides access to all the operations defined in DatabaseUsagesClient. */ +public interface DatabaseUsagesClient { + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentRuleBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentRuleBaselinesClient.java new file mode 100644 index 0000000000000..1c6776cbc9743 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentRuleBaselinesClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaselinesClient { + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters); + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentScansClient.java new file mode 100644 index 0000000000000..3cfc3b5b3c6dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentScansClient.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentScansClient. + */ +public interface DatabaseVulnerabilityAssessmentScansClient { + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..5a3265d701691 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentsClient.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in DatabaseVulnerabilityAssessmentsClient. + */ +public interface DatabaseVulnerabilityAssessmentsClient { + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters); + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java new file mode 100644 index 0000000000000..0d7fb193edbb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java @@ -0,0 +1,800 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUpdate; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public interface DatabasesClient { + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter); + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName); + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters); + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context); + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters); + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context); + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName); + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context); + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName); + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner pause(String resourceGroupName, String serverName, String databaseName); + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner pause(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginResume( + String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginResume( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner resume(String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner resume(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @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 failover(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @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 failover(String resourceGroupName, String serverName, String databaseName); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName, Context context); + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName); + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName); + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @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 rename(String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @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 renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.java new file mode 100644 index 0000000000000..acee0633e1e37 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ElasticPoolActivityInner; + +/** An instance of this class provides access to all the operations defined in ElasticPoolActivitiesClient. */ +public interface ElasticPoolActivitiesClient { + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @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 represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @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 represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.java new file mode 100644 index 0000000000000..9c7d33d6e77b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; + +/** An instance of this class provides access to all the operations defined in ElasticPoolDatabaseActivitiesClient. */ +public interface ElasticPoolDatabaseActivitiesClient { + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolOperationsClient.java new file mode 100644 index 0000000000000..e6bc24f2a58d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolOperationsClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ElasticPoolOperationInner; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in ElasticPoolOperationsClient. */ +public interface ElasticPoolOperationsClient { + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId); + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @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 cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context); + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java new file mode 100644 index 0000000000000..a3b2f4cbed0d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolUpdate; + +/** An instance of this class provides access to all the operations defined in ElasticPoolsClient. */ +public interface ElasticPoolsClient { + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter); + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context); + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @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 elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Integer skip, Context context); + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters); + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context); + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner createOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters); + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner createOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context); + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters); + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context); + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner update( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters); + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner update( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @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 failover(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EncryptionProtectorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EncryptionProtectorsClient.java new file mode 100644 index 0000000000000..8d6f33007cd0c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EncryptionProtectorsClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** An instance of this class provides access to all the operations defined in EncryptionProtectorsClient. */ +public interface EncryptionProtectorsClient { + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate(String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EncryptionProtectorInner get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedDatabaseBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedDatabaseBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..a100051d1f8b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedDatabaseBlobAuditingPoliciesClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; + +/** + * An instance of this class provides access to all the operations defined in + * ExtendedDatabaseBlobAuditingPoliciesClient. + */ +public interface ExtendedDatabaseBlobAuditingPoliciesClient { + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedDatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Creates or updates an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The extended database blob auditing policy. + * @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 an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedDatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters); + + /** + * Creates or updates an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The extended database blob auditing policy. + * @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 an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters, + Context context); + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedServerBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedServerBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..4e757ce042233 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedServerBlobAuditingPoliciesClient.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; + +/** + * An instance of this class provides access to all the operations defined in ExtendedServerBlobAuditingPoliciesClient. + */ +public interface ExtendedServerBlobAuditingPoliciesClient { + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName); + + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters); + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context); + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters); + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters, Context context); + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FailoverGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FailoverGroupsClient.java new file mode 100644 index 0000000000000..1c5e656ba3f2b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FailoverGroupsClient.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupUpdate; + +/** An instance of this class provides access to all the operations defined in FailoverGroupsClient. */ +public interface FailoverGroupsClient { + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner get(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner createOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters); + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context); + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner update( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters); + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner update( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context); + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.java new file mode 100644 index 0000000000000..ef77edc3c372f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.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.sql.generated.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.sql.generated.fluent.models.FirewallRuleInner; + +/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +public interface FirewallRulesClient { + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 serverName, String firewallRuleName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 serverName, String firewallRuleName, Context context); + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/GeoBackupPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/GeoBackupPoliciesClient.java new file mode 100644 index 0000000000000..abe8572107c1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/GeoBackupPoliciesClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; + +/** An instance of this class provides access to all the operations defined in GeoBackupPoliciesClient. */ +public interface GeoBackupPoliciesClient { + /** + * Updates a database geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @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 database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GeoBackupPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters); + + /** + * Updates a database geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @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 database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters, + Context context); + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @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 geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GeoBackupPolicyInner get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName); + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @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 geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context); + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ImportExportsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ImportExportsClient.java new file mode 100644 index 0000000000000..0009bd6b65325 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ImportExportsClient.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; + +/** An instance of this class provides access to all the operations defined in ImportExportsClient. */ +public interface ImportExportsClient { + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstanceFailoverGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstanceFailoverGroupsClient.java new file mode 100644 index 0000000000000..3fff6a86ce3f9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstanceFailoverGroupsClient.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; + +/** An instance of this class provides access to all the operations defined in InstanceFailoverGroupsClient. */ +public interface InstanceFailoverGroupsClient { + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters); + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner failover(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstanceFailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstanceFailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstancePoolsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstancePoolsClient.java new file mode 100644 index 0000000000000..48255d4c828c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstancePoolsClient.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePoolUpdate; + +/** An instance of this class provides access to all the operations defined in InstancePoolsClient. */ +public interface InstancePoolsClient { + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner getByResourceGroup(String resourceGroupName, String instancePoolName); + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner createOrUpdate(String resourceGroupName, String instancePoolName, InstancePoolInner parameters); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner createOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String instancePoolName); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String instancePoolName, Context context); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @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 instancePoolName); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String instancePoolName, Context context); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner update(String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner update( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobAgentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobAgentsClient.java new file mode 100644 index 0000000000000..e55c713ffbee6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobAgentsClient.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgentUpdate; + +/** An instance of this class provides access to all the operations defined in JobAgentsClient. */ +public interface JobAgentsClient { + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner get(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters); + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context); + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters); + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context); + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @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 serverName, String jobAgentName); + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters); + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context); + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters); + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner update( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobCredentialsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobCredentialsClient.java new file mode 100644 index 0000000000000..95558b0913cad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobCredentialsClient.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.JobCredentialInner; + +/** An instance of this class provides access to all the operations defined in JobCredentialsClient. */ +public interface JobCredentialsClient { + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobCredentialInner get(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context); + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @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 stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobCredentialInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters); + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @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 stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters, + Context context); + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName); + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobExecutionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobExecutionsClient.java new file mode 100644 index 0000000000000..ebec080f263ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobExecutionsClient.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in JobExecutionsClient. */ +public interface JobExecutionsClient { + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancel(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @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 job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @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 job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepExecutionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepExecutionsClient.java new file mode 100644 index 0000000000000..831546d230e8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepExecutionsClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in JobStepExecutionsClient. */ +public interface JobStepExecutionsClient { + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @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 step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @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 step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepsClient.java new file mode 100644 index 0000000000000..d9b780fbd67c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepsClient.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.JobStepInner; + +/** An instance of this class provides access to all the operations defined in JobStepsClient. */ +public interface JobStepsClient { + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobStepInner getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName); + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context); + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobStepInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobStepInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters); + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters, + Context context); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, String jobAgentName, String jobName, String stepName); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetExecutionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetExecutionsClient.java new file mode 100644 index 0000000000000..bd81fd28aeadb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetExecutionsClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in JobTargetExecutionsClient. */ +public interface JobTargetExecutionsClient { + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target 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 target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId); + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target 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 target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetGroupsClient.java new file mode 100644 index 0000000000000..f5034faa3c1a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetGroupsClient.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.JobTargetGroupInner; + +/** An instance of this class provides access to all the operations defined in JobTargetGroupsClient. */ +public interface JobTargetGroupsClient { + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobTargetGroupInner get(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobTargetGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters); + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param parameters The requested state of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters, + Context context); + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobVersionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobVersionsClient.java new file mode 100644 index 0000000000000..eafcb911c4a1e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobVersionsClient.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.JobVersionInner; + +/** An instance of this class provides access to all the operations defined in JobVersionsClient. */ +public interface JobVersionsClient { + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobVersionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobsClient.java new file mode 100644 index 0000000000000..817f8a0e51f22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobsClient.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.JobInner; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public interface JobsClient { + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters); + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + JobInner parameters, + Context context); + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName); + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionBackupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionBackupsClient.java new file mode 100644 index 0000000000000..e5732266d489f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionBackupsClient.java @@ -0,0 +1,882 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionBackupsClient. */ +public interface LongTermRetentionBackupsClient { + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupInner get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java new file mode 100644 index 0000000000000..0956273fa1ec1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; + +/** + * An instance of this class provides access to all the operations defined in + * LongTermRetentionManagedInstanceBackupsClient. + */ +public interface LongTermRetentionManagedInstanceBackupsClient { + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionBackupInner get( + String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..e8b797f9a5c42 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionPoliciesClient.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionPoliciesClient. */ +public interface LongTermRetentionPoliciesClient { + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedBackupShortTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedBackupShortTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..ca1ee915678dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedBackupShortTermRetentionPoliciesClient.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedBackupShortTermRetentionPoliciesClient. + */ +public interface ManagedBackupShortTermRetentionPoliciesClient { + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName); + + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRestoreDetailsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRestoreDetailsClient.java new file mode 100644 index 0000000000000..c7ef01d500f78 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRestoreDetailsClient.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseRestoreDetailsClient. */ +public interface ManagedDatabaseRestoreDetailsClient { + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @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 managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseRestoreDetailsResultInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName); + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @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 managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..5e9b6e5968fb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityAlertPoliciesClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseSecurityAlertPoliciesClient. + */ +public interface ManagedDatabaseSecurityAlertPoliciesClient { + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @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 managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @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 managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters, + Context context); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java new file mode 100644 index 0000000000000..f04262ebea24d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** + * An instance of this class provides access to all the operations defined in ManagedDatabaseSensitivityLabelsClient. + */ +public interface ManagedDatabaseSensitivityLabelsClient { + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.java new file mode 100644 index 0000000000000..f5fca8ec90b39 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters); + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentScansClient.java new file mode 100644 index 0000000000000..f98465041d637 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentScansClient.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentScansClient. + */ +public interface ManagedDatabaseVulnerabilityAssessmentScansClient { + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..be6c9ad20e8b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentsClient.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentsClient. + */ +public interface ManagedDatabaseVulnerabilityAssessmentsClient { + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters); + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java new file mode 100644 index 0000000000000..5a8db22caa9ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseUpdate; + +/** An instance of this class provides access to all the operations defined in ManagedDatabasesClient. */ +public interface ManagedDatabasesClient { + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managedInstanceName, String databaseName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner update( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @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 completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context); + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.java new file mode 100644 index 0000000000000..2b86a05392c2f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceAdministratorsClient. */ +public interface ManagedInstanceAdministratorsClient { + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdministratorInner get(String resourceGroupName, String managedInstanceName); + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceAdministratorInner parameters); + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + ManagedInstanceAdministratorInner parameters, + Context context); + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceAdministratorInner parameters); + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + ManagedInstanceAdministratorInner parameters, + Context context); + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String managedInstanceName); + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managedInstanceName); + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.java new file mode 100644 index 0000000000000..68fcb96e7ca76 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceAzureADOnlyAuthenticationsClient. + */ +public interface ManagedInstanceAzureADOnlyAuthenticationsClient { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAzureADOnlyAuthenticationInner get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 managedInstanceName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceEncryptionProtectorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceEncryptionProtectorsClient.java new file mode 100644 index 0000000000000..2bf533ffd6e7f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceEncryptionProtectorsClient.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstanceEncryptionProtectorsClient. + */ +public interface ManagedInstanceEncryptionProtectorsClient { + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceEncryptionProtectorInner get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceKeysClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceKeysClient.java new file mode 100644 index 0000000000000..3939d4a6c2780 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceKeysClient.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceKeysClient. */ +public interface ManagedInstanceKeysClient { + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context); + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceKeyInner get(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters); + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context); + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters); + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context); + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName); + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @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 managedInstanceName, String keyName); + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceLongTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceLongTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..ffbe2951fa6ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceLongTermRetentionPoliciesClient.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceLongTermRetentionPoliciesClient. + */ +public interface ManagedInstanceLongTermRetentionPoliciesClient { + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName); + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceOperationsClient.java new file mode 100644 index 0000000000000..025ca95535b11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceOperationsClient.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ManagedInstanceOperationInner; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceOperationsClient. */ +public interface ManagedInstanceOperationsClient { + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(String resourceGroupName, String managedInstanceName, UUID operationId); + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceOperationInner get(String resourceGroupName, String managedInstanceName, UUID operationId); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceTdeCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceTdeCertificatesClient.java new file mode 100644 index 0000000000000..2cef38f309fd4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceTdeCertificatesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceTdeCertificatesClient. */ +public interface ManagedInstanceTdeCertificatesClient { + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..41d9bbb5f42fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceVulnerabilityAssessmentsClient. + */ +public interface ManagedInstanceVulnerabilityAssessmentsClient { + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceVulnerabilityAssessmentInner get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters); + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java new file mode 100644 index 0000000000000..23591794960fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.AggregationFunctionType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceUpdate; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** An instance of this class provides access to all the operations defined in ManagedInstancesClient. */ +public interface ManagedInstancesClient { + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Context context); + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName); + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters); + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context); + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters); + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, Context context); + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters); + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context); + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner update(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters); + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner update( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context); + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @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 top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @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 failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @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 failover(String resourceGroupName, String managedInstanceName); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context); + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all managed instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..0875b3380d5c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient. + */ +public interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName); + + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..c53140a81a458 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; + +/** + * An instance of this class provides access to all the operations defined in ManagedServerSecurityAlertPoliciesClient. + */ +public interface ManagedServerSecurityAlertPoliciesClient { + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerSecurityAlertPolicyInner get( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName); + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..56424fb366161 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.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.sql.generated.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 Rest API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateEndpointConnectionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..f4dbd5de0bed3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateLinkResourcesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..212e9674b2dd8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 the private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @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 private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName); + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @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 private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedElasticPoolsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedElasticPoolsClient.java new file mode 100644 index 0000000000000..4f976265c7750 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedElasticPoolsClient.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.RecommendedElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner; + +/** An instance of this class provides access to all the operations defined in RecommendedElasticPoolsClient. */ +public interface RecommendedElasticPoolsClient { + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 recommended elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendedElasticPoolInner get(String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 recommended elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context); + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.java new file mode 100644 index 0000000000000..46d3dc1149cda --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.RecoverableDatabaseInner; + +/** An instance of this class provides access to all the operations defined in RecoverableDatabasesClient. */ +public interface RecoverableDatabasesClient { + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoverableDatabaseInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableManagedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableManagedDatabasesClient.java new file mode 100644 index 0000000000000..e6af2da1066fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableManagedDatabasesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.RecoverableManagedDatabaseInner; + +/** An instance of this class provides access to all the operations defined in RecoverableManagedDatabasesClient. */ +public interface RecoverableManagedDatabasesClient { + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoverableManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName); + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.java new file mode 100644 index 0000000000000..02603922e1a4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.UnlinkParameters; + +/** An instance of this class provides access to all the operations defined in ReplicationLinksClient. */ +public interface ReplicationLinksClient { + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 serverName, String databaseName, String linkId); + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 serverName, String databaseName, String linkId, Context context); + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 database replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 database replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failover(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginUnlink( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters); + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginUnlink( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context); + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @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 unlink( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters); + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void unlink( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context); + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @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 represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @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 represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.java new file mode 100644 index 0000000000000..17d8a133f676e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.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.sql.generated.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.sql.generated.fluent.models.RestorableDroppedDatabaseInner; + +/** An instance of this class provides access to all the operations defined in RestorableDroppedDatabasesClient. */ +public interface RestorableDroppedDatabasesClient { + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @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 deleted database that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorableDroppedDatabaseInner get( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId); + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @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 deleted database that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId, Context context); + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedManagedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedManagedDatabasesClient.java new file mode 100644 index 0000000000000..5b39461a74bb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedManagedDatabasesClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; + +/** + * An instance of this class provides access to all the operations defined in RestorableDroppedManagedDatabasesClient. + */ +public interface RestorableDroppedManagedDatabasesClient { + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorableDroppedManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorePointsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorePointsClient.java new file mode 100644 index 0000000000000..28d82e9c53b7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorePointsClient.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; + +/** An instance of this class provides access to all the operations defined in RestorePointsClient. */ +public interface RestorePointsClient { + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context); + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner get(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context); + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 serverName, String databaseName, String restorePointName); + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 serverName, String databaseName, String restorePointName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java new file mode 100644 index 0000000000000..d3f748fae20fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** An instance of this class provides access to all the operations defined in SensitivityLabelsClient. */ +public interface SensitivityLabelsClient { + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAutomaticTuningsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAutomaticTuningsClient.java new file mode 100644 index 0000000000000..6e718ec5fbc77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAutomaticTuningsClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; + +/** An instance of this class provides access to all the operations defined in ServerAutomaticTuningsClient. */ +public interface ServerAutomaticTuningsClient { + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAutomaticTuningInner get(String resourceGroupName, String serverName); + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAutomaticTuningInner update( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters); + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.java new file mode 100644 index 0000000000000..6a0f5cba5ec0c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** An instance of this class provides access to all the operations defined in ServerAzureADAdministratorsClient. */ +public interface ServerAzureADAdministratorsClient { + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADAdministratorInner get( + String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters); + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context); + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters); + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 serverName, AdministratorName administratorName); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.java new file mode 100644 index 0000000000000..01303b88b8c6f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** + * An instance of this class provides access to all the operations defined in ServerAzureADOnlyAuthenticationsClient. + */ +public interface ServerAzureADOnlyAuthenticationsClient { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADOnlyAuthenticationInner get( + String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 serverName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..428591b05cbcc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerBlobAuditingPoliciesClient.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.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; + +/** An instance of this class provides access to all the operations defined in ServerBlobAuditingPoliciesClient. */ +public interface ServerBlobAuditingPoliciesClient { + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName); + + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters); + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context); + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters); + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context); + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerCommunicationLinksClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerCommunicationLinksClient.java new file mode 100644 index 0000000000000..4eb1fbd6f8cf2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerCommunicationLinksClient.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; + +/** An instance of this class provides access to all the operations defined in ServerCommunicationLinksClient. */ +public interface ServerCommunicationLinksClient { + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 serverName, String communicationLinkName); + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 serverName, String communicationLinkName, Context context); + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerCommunicationLinkInner get(String resourceGroupName, String serverName, String communicationLinkName); + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context); + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters); + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context); + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters); + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context); + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server communication links. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server communication links. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.java new file mode 100644 index 0000000000000..3c90174049867 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; + +/** An instance of this class provides access to all the operations defined in ServerConnectionPoliciesClient. */ +public interface ServerConnectionPoliciesClient { + /** + * Creates or updates the server's connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a secure connection policy. + * @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 server secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters); + + /** + * Creates or updates the server's connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a secure connection policy. + * @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 server secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context); + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @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 server's secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName); + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @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 server's secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDevOpsAuditSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDevOpsAuditSettingsClient.java new file mode 100644 index 0000000000000..744fda7bfd8f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDevOpsAuditSettingsClient.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.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; + +/** An instance of this class provides access to all the operations defined in ServerDevOpsAuditSettingsClient. */ +public interface ServerDevOpsAuditSettingsClient { + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @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 server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDevOpsAuditingSettingsInner get( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName); + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @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 server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName, Context context); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerDevOpsAuditingSettingsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerDevOpsAuditingSettingsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context); + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.java new file mode 100644 index 0000000000000..d31be446b7bc2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; + +/** An instance of this class provides access to all the operations defined in ServerDnsAliasesClient. */ +public interface ServerDnsAliasesClient { + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner get(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner createOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 serverName, String dnsAliasName); + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginAcquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters); + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginAcquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context); + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters); + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerKeysClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerKeysClient.java new file mode 100644 index 0000000000000..2805978eda9b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerKeysClient.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; + +/** An instance of this class provides access to all the operations defined in ServerKeysClient. */ +public interface ServerKeysClient { + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner get(String resourceGroupName, String serverName, String keyName); + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters); + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context); + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters); + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context); + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String keyName); + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @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 serverName, String keyName); + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String keyName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..ed4337490b5a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public interface ServerSecurityAlertPoliciesClient { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 the server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustGroupsClient.java new file mode 100644 index 0000000000000..8286f5787a7d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustGroupsClient.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; + +/** An instance of this class provides access to all the operations defined in ServerTrustGroupsClient. */ +public interface ServerTrustGroupsClient { + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustGroupInner get(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters); + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context); + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustGroupInner createOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters); + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context); + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String resourceGroupName, String locationName, Context context); + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.java new file mode 100644 index 0000000000000..46773deb0a285 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ServerUsageInner; + +/** An instance of this class provides access to all the operations defined in ServerUsagesClient. */ +public interface ServerUsagesClient { + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..3d624e6ef4dd0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.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.sql.generated.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.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** An instance of this class provides access to all the operations defined in ServerVulnerabilityAssessmentsClient. */ +public interface ServerVulnerabilityAssessmentsClient { + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentInner get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters); + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java new file mode 100644 index 0000000000000..78482e80ce2bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ServerUpdate; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public interface ServersClient { + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner getByResourceGroup(String resourceGroupName, String serverName); + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters); + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters, Context context); + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters); + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters, Context context); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, Context context); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 serverName); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, Context context); + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters); + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context); + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters); + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters, Context context); + + /** + * Gets a list of all servers in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all servers in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest parameters); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImportExportOperationResultInner> beginImportDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImportExportOperationResultInner> beginImportDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.java new file mode 100644 index 0000000000000..4ecc383f85c34 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ServiceObjectiveInner; + +/** An instance of this class provides access to all the operations defined in ServiceObjectivesClient. */ +public interface ServiceObjectivesClient { + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @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 database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceObjectiveInner get(String resourceGroupName, String serverName, String serviceObjectiveName); + + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @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 database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context); + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceTierAdvisorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceTierAdvisorsClient.java new file mode 100644 index 0000000000000..f31b8647e5fb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceTierAdvisorsClient.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.ServiceTierAdvisorInner; + +/** An instance of this class provides access to all the operations defined in ServiceTierAdvisorsClient. */ +public interface ServiceTierAdvisorsClient { + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 service tier advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceTierAdvisorInner get( + String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName); + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 service tier advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String serviceTierAdvisorName, + Context context); + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @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 represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @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 represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java new file mode 100644 index 0000000000000..1f374fc8f0485 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java @@ -0,0 +1,712 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for SqlManagementClient class. */ +public interface SqlManagementClient { + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the RecoverableDatabasesClient object to access its operations. + * + * @return the RecoverableDatabasesClient object. + */ + RecoverableDatabasesClient getRecoverableDatabases(); + + /** + * Gets the RestorableDroppedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedDatabasesClient object. + */ + RestorableDroppedDatabasesClient getRestorableDroppedDatabases(); + + /** + * Gets the ServerConnectionPoliciesClient object to access its operations. + * + * @return the ServerConnectionPoliciesClient object. + */ + ServerConnectionPoliciesClient getServerConnectionPolicies(); + + /** + * Gets the DatabaseThreatDetectionPoliciesClient object to access its operations. + * + * @return the DatabaseThreatDetectionPoliciesClient object. + */ + DatabaseThreatDetectionPoliciesClient getDatabaseThreatDetectionPolicies(); + + /** + * Gets the DataMaskingPoliciesClient object to access its operations. + * + * @return the DataMaskingPoliciesClient object. + */ + DataMaskingPoliciesClient getDataMaskingPolicies(); + + /** + * Gets the DataMaskingRulesClient object to access its operations. + * + * @return the DataMaskingRulesClient object. + */ + DataMaskingRulesClient getDataMaskingRules(); + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the GeoBackupPoliciesClient object to access its operations. + * + * @return the GeoBackupPoliciesClient object. + */ + GeoBackupPoliciesClient getGeoBackupPolicies(); + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + DatabasesClient getDatabases(); + + /** + * Gets the ElasticPoolsClient object to access its operations. + * + * @return the ElasticPoolsClient object. + */ + ElasticPoolsClient getElasticPools(); + + /** + * Gets the RecommendedElasticPoolsClient object to access its operations. + * + * @return the RecommendedElasticPoolsClient object. + */ + RecommendedElasticPoolsClient getRecommendedElasticPools(); + + /** + * Gets the ReplicationLinksClient object to access its operations. + * + * @return the ReplicationLinksClient object. + */ + ReplicationLinksClient getReplicationLinks(); + + /** + * Gets the ServerCommunicationLinksClient object to access its operations. + * + * @return the ServerCommunicationLinksClient object. + */ + ServerCommunicationLinksClient getServerCommunicationLinks(); + + /** + * Gets the ServiceObjectivesClient object to access its operations. + * + * @return the ServiceObjectivesClient object. + */ + ServiceObjectivesClient getServiceObjectives(); + + /** + * Gets the ElasticPoolActivitiesClient object to access its operations. + * + * @return the ElasticPoolActivitiesClient object. + */ + ElasticPoolActivitiesClient getElasticPoolActivities(); + + /** + * Gets the ElasticPoolDatabaseActivitiesClient object to access its operations. + * + * @return the ElasticPoolDatabaseActivitiesClient object. + */ + ElasticPoolDatabaseActivitiesClient getElasticPoolDatabaseActivities(); + + /** + * Gets the ServiceTierAdvisorsClient object to access its operations. + * + * @return the ServiceTierAdvisorsClient object. + */ + ServiceTierAdvisorsClient getServiceTierAdvisors(); + + /** + * Gets the TransparentDataEncryptionsClient object to access its operations. + * + * @return the TransparentDataEncryptionsClient object. + */ + TransparentDataEncryptionsClient getTransparentDataEncryptions(); + + /** + * Gets the TransparentDataEncryptionActivitiesClient object to access its operations. + * + * @return the TransparentDataEncryptionActivitiesClient object. + */ + TransparentDataEncryptionActivitiesClient getTransparentDataEncryptionActivities(); + + /** + * Gets the ServerUsagesClient object to access its operations. + * + * @return the ServerUsagesClient object. + */ + ServerUsagesClient getServerUsages(); + + /** + * Gets the DatabaseUsagesClient object to access its operations. + * + * @return the DatabaseUsagesClient object. + */ + DatabaseUsagesClient getDatabaseUsages(); + + /** + * Gets the DatabaseAutomaticTuningsClient object to access its operations. + * + * @return the DatabaseAutomaticTuningsClient object. + */ + DatabaseAutomaticTuningsClient getDatabaseAutomaticTunings(); + + /** + * Gets the EncryptionProtectorsClient object to access its operations. + * + * @return the EncryptionProtectorsClient object. + */ + EncryptionProtectorsClient getEncryptionProtectors(); + + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + FailoverGroupsClient getFailoverGroups(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ServerKeysClient object to access its operations. + * + * @return the ServerKeysClient object. + */ + ServerKeysClient getServerKeys(); + + /** + * Gets the SyncAgentsClient object to access its operations. + * + * @return the SyncAgentsClient object. + */ + SyncAgentsClient getSyncAgents(); + + /** + * Gets the SubscriptionUsagesClient object to access its operations. + * + * @return the SubscriptionUsagesClient object. + */ + SubscriptionUsagesClient getSubscriptionUsages(); + + /** + * Gets the VirtualClustersClient object to access its operations. + * + * @return the VirtualClustersClient object. + */ + VirtualClustersClient getVirtualClusters(); + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + VirtualNetworkRulesClient getVirtualNetworkRules(); + + /** + * Gets the ExtendedDatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedDatabaseBlobAuditingPoliciesClient object. + */ + ExtendedDatabaseBlobAuditingPoliciesClient getExtendedDatabaseBlobAuditingPolicies(); + + /** + * Gets the ExtendedServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedServerBlobAuditingPoliciesClient object. + */ + ExtendedServerBlobAuditingPoliciesClient getExtendedServerBlobAuditingPolicies(); + + /** + * Gets the ServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ServerBlobAuditingPoliciesClient object. + */ + ServerBlobAuditingPoliciesClient getServerBlobAuditingPolicies(); + + /** + * Gets the DatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the DatabaseBlobAuditingPoliciesClient object. + */ + DatabaseBlobAuditingPoliciesClient getDatabaseBlobAuditingPolicies(); + + /** + * Gets the DatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + DatabaseVulnerabilityAssessmentRuleBaselinesClient getDatabaseVulnerabilityAssessmentRuleBaselines(); + + /** + * Gets the DatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentsClient object. + */ + DatabaseVulnerabilityAssessmentsClient getDatabaseVulnerabilityAssessments(); + + /** + * Gets the JobAgentsClient object to access its operations. + * + * @return the JobAgentsClient object. + */ + JobAgentsClient getJobAgents(); + + /** + * Gets the JobCredentialsClient object to access its operations. + * + * @return the JobCredentialsClient object. + */ + JobCredentialsClient getJobCredentials(); + + /** + * Gets the JobExecutionsClient object to access its operations. + * + * @return the JobExecutionsClient object. + */ + JobExecutionsClient getJobExecutions(); + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + JobsClient getJobs(); + + /** + * Gets the JobStepExecutionsClient object to access its operations. + * + * @return the JobStepExecutionsClient object. + */ + JobStepExecutionsClient getJobStepExecutions(); + + /** + * Gets the JobStepsClient object to access its operations. + * + * @return the JobStepsClient object. + */ + JobStepsClient getJobSteps(); + + /** + * Gets the JobTargetExecutionsClient object to access its operations. + * + * @return the JobTargetExecutionsClient object. + */ + JobTargetExecutionsClient getJobTargetExecutions(); + + /** + * Gets the JobTargetGroupsClient object to access its operations. + * + * @return the JobTargetGroupsClient object. + */ + JobTargetGroupsClient getJobTargetGroups(); + + /** + * Gets the JobVersionsClient object to access its operations. + * + * @return the JobVersionsClient object. + */ + JobVersionsClient getJobVersions(); + + /** + * Gets the ManagedBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedBackupShortTermRetentionPoliciesClient object. + */ + ManagedBackupShortTermRetentionPoliciesClient getManagedBackupShortTermRetentionPolicies(); + + /** + * Gets the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object. + */ + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient + getManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + + /** + * Gets the ServerAutomaticTuningsClient object to access its operations. + * + * @return the ServerAutomaticTuningsClient object. + */ + ServerAutomaticTuningsClient getServerAutomaticTunings(); + + /** + * Gets the ServerDnsAliasesClient object to access its operations. + * + * @return the ServerDnsAliasesClient object. + */ + ServerDnsAliasesClient getServerDnsAliases(); + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies(); + + /** + * Gets the RestorableDroppedManagedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedManagedDatabasesClient object. + */ + RestorableDroppedManagedDatabasesClient getRestorableDroppedManagedDatabases(); + + /** + * Gets the RestorePointsClient object to access its operations. + * + * @return the RestorePointsClient object. + */ + RestorePointsClient getRestorePoints(); + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedDatabaseSecurityAlertPoliciesClient object. + */ + ManagedDatabaseSecurityAlertPoliciesClient getManagedDatabaseSecurityAlertPolicies(); + + /** + * Gets the ManagedServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedServerSecurityAlertPoliciesClient object. + */ + ManagedServerSecurityAlertPoliciesClient getManagedServerSecurityAlertPolicies(); + + /** + * Gets the SensitivityLabelsClient object to access its operations. + * + * @return the SensitivityLabelsClient object. + */ + SensitivityLabelsClient getSensitivityLabels(); + + /** + * Gets the ManagedInstanceAdministratorsClient object to access its operations. + * + * @return the ManagedInstanceAdministratorsClient object. + */ + ManagedInstanceAdministratorsClient getManagedInstanceAdministrators(); + + /** + * Gets the DatabaseOperationsClient object to access its operations. + * + * @return the DatabaseOperationsClient object. + */ + DatabaseOperationsClient getDatabaseOperations(); + + /** + * Gets the ElasticPoolOperationsClient object to access its operations. + * + * @return the ElasticPoolOperationsClient object. + */ + ElasticPoolOperationsClient getElasticPoolOperations(); + + /** + * Gets the DatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentScansClient object. + */ + DatabaseVulnerabilityAssessmentScansClient getDatabaseVulnerabilityAssessmentScans(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient getManagedDatabaseVulnerabilityAssessmentRuleBaselines(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentScansClient object. + */ + ManagedDatabaseVulnerabilityAssessmentScansClient getManagedDatabaseVulnerabilityAssessmentScans(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentsClient object. + */ + ManagedDatabaseVulnerabilityAssessmentsClient getManagedDatabaseVulnerabilityAssessments(); + + /** + * Gets the InstanceFailoverGroupsClient object to access its operations. + * + * @return the InstanceFailoverGroupsClient object. + */ + InstanceFailoverGroupsClient getInstanceFailoverGroups(); + + /** + * Gets the TdeCertificatesClient object to access its operations. + * + * @return the TdeCertificatesClient object. + */ + TdeCertificatesClient getTdeCertificates(); + + /** + * Gets the ManagedInstanceTdeCertificatesClient object to access its operations. + * + * @return the ManagedInstanceTdeCertificatesClient object. + */ + ManagedInstanceTdeCertificatesClient getManagedInstanceTdeCertificates(); + + /** + * Gets the ManagedInstanceKeysClient object to access its operations. + * + * @return the ManagedInstanceKeysClient object. + */ + ManagedInstanceKeysClient getManagedInstanceKeys(); + + /** + * Gets the ManagedInstanceEncryptionProtectorsClient object to access its operations. + * + * @return the ManagedInstanceEncryptionProtectorsClient object. + */ + ManagedInstanceEncryptionProtectorsClient getManagedInstanceEncryptionProtectors(); + + /** + * Gets the RecoverableManagedDatabasesClient object to access its operations. + * + * @return the RecoverableManagedDatabasesClient object. + */ + RecoverableManagedDatabasesClient getRecoverableManagedDatabases(); + + /** + * Gets the BackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the BackupShortTermRetentionPoliciesClient object. + */ + BackupShortTermRetentionPoliciesClient getBackupShortTermRetentionPolicies(); + + /** + * Gets the ManagedInstanceVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedInstanceVulnerabilityAssessmentsClient object. + */ + ManagedInstanceVulnerabilityAssessmentsClient getManagedInstanceVulnerabilityAssessments(); + + /** + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsClient object. + */ + ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments(); + + /** + * Gets the ManagedDatabaseSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseSensitivityLabelsClient object. + */ + ManagedDatabaseSensitivityLabelsClient getManagedDatabaseSensitivityLabels(); + + /** + * Gets the InstancePoolsClient object to access its operations. + * + * @return the InstancePoolsClient object. + */ + InstancePoolsClient getInstancePools(); + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + UsagesClient getUsages(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + ServersClient getServers(); + + /** + * Gets the CapabilitiesClient object to access its operations. + * + * @return the CapabilitiesClient object. + */ + CapabilitiesClient getCapabilities(); + + /** + * Gets the LongTermRetentionManagedInstanceBackupsClient object to access its operations. + * + * @return the LongTermRetentionManagedInstanceBackupsClient object. + */ + LongTermRetentionManagedInstanceBackupsClient getLongTermRetentionManagedInstanceBackups(); + + /** + * Gets the ManagedInstanceLongTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedInstanceLongTermRetentionPoliciesClient object. + */ + ManagedInstanceLongTermRetentionPoliciesClient getManagedInstanceLongTermRetentionPolicies(); + + /** + * Gets the WorkloadGroupsClient object to access its operations. + * + * @return the WorkloadGroupsClient object. + */ + WorkloadGroupsClient getWorkloadGroups(); + + /** + * Gets the WorkloadClassifiersClient object to access its operations. + * + * @return the WorkloadClassifiersClient object. + */ + WorkloadClassifiersClient getWorkloadClassifiers(); + + /** + * Gets the ManagedInstanceOperationsClient object to access its operations. + * + * @return the ManagedInstanceOperationsClient object. + */ + ManagedInstanceOperationsClient getManagedInstanceOperations(); + + /** + * Gets the ServerAzureADAdministratorsClient object to access its operations. + * + * @return the ServerAzureADAdministratorsClient object. + */ + ServerAzureADAdministratorsClient getServerAzureADAdministrators(); + + /** + * Gets the SyncGroupsClient object to access its operations. + * + * @return the SyncGroupsClient object. + */ + SyncGroupsClient getSyncGroups(); + + /** + * Gets the SyncMembersClient object to access its operations. + * + * @return the SyncMembersClient object. + */ + SyncMembersClient getSyncMembers(); + + /** + * Gets the ImportExportsClient object to access its operations. + * + * @return the ImportExportsClient object. + */ + ImportExportsClient getImportExports(); + + /** + * Gets the ManagedDatabasesClient object to access its operations. + * + * @return the ManagedDatabasesClient object. + */ + ManagedDatabasesClient getManagedDatabases(); + + /** + * Gets the ManagedDatabaseRestoreDetailsClient object to access its operations. + * + * @return the ManagedDatabaseRestoreDetailsClient object. + */ + ManagedDatabaseRestoreDetailsClient getManagedDatabaseRestoreDetails(); + + /** + * Gets the ServerAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ServerAzureADOnlyAuthenticationsClient object. + */ + ServerAzureADOnlyAuthenticationsClient getServerAzureADOnlyAuthentications(); + + /** + * Gets the ManagedInstancesClient object to access its operations. + * + * @return the ManagedInstancesClient object. + */ + ManagedInstancesClient getManagedInstances(); + + /** + * Gets the ManagedInstanceAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ManagedInstanceAzureADOnlyAuthenticationsClient object. + */ + ManagedInstanceAzureADOnlyAuthenticationsClient getManagedInstanceAzureADOnlyAuthentications(); + + /** + * Gets the ServerTrustGroupsClient object to access its operations. + * + * @return the ServerTrustGroupsClient object. + */ + ServerTrustGroupsClient getServerTrustGroups(); + + /** + * Gets the ServerDevOpsAuditSettingsClient object to access its operations. + * + * @return the ServerDevOpsAuditSettingsClient object. + */ + ServerDevOpsAuditSettingsClient getServerDevOpsAuditSettings(); + + /** + * Gets the LongTermRetentionBackupsClient object to access its operations. + * + * @return the LongTermRetentionBackupsClient object. + */ + LongTermRetentionBackupsClient getLongTermRetentionBackups(); + + /** + * Gets the LongTermRetentionPoliciesClient object to access its operations. + * + * @return the LongTermRetentionPoliciesClient object. + */ + LongTermRetentionPoliciesClient getLongTermRetentionPolicies(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SubscriptionUsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SubscriptionUsagesClient.java new file mode 100644 index 0000000000000..a82517f7bf6ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SubscriptionUsagesClient.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.sql.generated.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.sql.generated.fluent.models.SubscriptionUsageInner; + +/** An instance of this class provides access to all the operations defined in SubscriptionUsagesClient. */ +public interface SubscriptionUsagesClient { + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName, Context context); + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionUsageInner get(String locationName, String usageName); + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String usageName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncAgentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncAgentsClient.java new file mode 100644 index 0000000000000..71974d603b6ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncAgentsClient.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; + +/** An instance of this class provides access to all the operations defined in SyncAgentsClient. */ +public interface SyncAgentsClient { + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentInner get(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters); + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context); + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters); + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 serverName, String syncAgentName); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentKeyPropertiesInner generateKey(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName); + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncGroupsClient.java new file mode 100644 index 0000000000000..6a36bd693a67c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncGroupsClient.java @@ -0,0 +1,587 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; + +/** An instance of this class provides access to all the operations defined in SyncGroupsClient. */ +public interface SyncGroupsClient { + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSyncDatabaseIds(String locationName); + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSyncDatabaseIds(String locationName, Context context); + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type); + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @param continuationToken The continuation token for this operation. + * @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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context); + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncMembersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncMembersClient.java new file mode 100644 index 0000000000000..60b7766310f6e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncMembersClient.java @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; + +/** An instance of this class provides access to all the operations defined in SyncMembersClient. */ +public interface SyncMembersClient { + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMemberSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TdeCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TdeCertificatesClient.java new file mode 100644 index 0000000000000..15969e6a32660 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TdeCertificatesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** An instance of this class provides access to all the operations defined in TdeCertificatesClient. */ +public interface TdeCertificatesClient { + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String serverName, TdeCertificate parameters); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionActivitiesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionActivitiesClient.java new file mode 100644 index 0000000000000..a56dc5eceb015 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionActivitiesClient.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.sql.generated.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.sql.generated.fluent.models.TransparentDataEncryptionActivityInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** + * An instance of this class provides access to all the operations defined in TransparentDataEncryptionActivitiesClient. + */ +public interface TransparentDataEncryptionActivitiesClient { + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName); + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java new file mode 100644 index 0000000000000..28ebb9917ec03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** An instance of this class provides access to all the operations defined in TransparentDataEncryptionsClient. */ +public interface TransparentDataEncryptionsClient { + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @param parameters The required parameters for creating or updating transparent data encryption. + * @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 represents a database transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + TransparentDataEncryptionInner parameters); + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @param parameters The required parameters for creating or updating transparent data encryption. + * @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 represents a database transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + TransparentDataEncryptionInner parameters, + Context context); + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 database's transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransparentDataEncryptionInner get( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName); + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 database's transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/UsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/UsagesClient.java new file mode 100644 index 0000000000000..c1da7e1727c53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/UsagesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public interface UsagesClient { + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.java new file mode 100644 index 0000000000000..083cec010a768 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; + +/** An instance of this class provides access to all the operations defined in VirtualClustersClient. */ +public interface VirtualClustersClient { + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualClusterInner getByResourceGroup(String resourceGroupName, String virtualClusterName); + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualClusterName); + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName); + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualClusterName, Context context); + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters); + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context); + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualClusterInner update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters); + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualClusterInner update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualNetworkRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualNetworkRulesClient.java new file mode 100644 index 0000000000000..e74df82daec07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualNetworkRulesClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public interface VirtualNetworkRulesClient { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadClassifiersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadClassifiersClient.java new file mode 100644 index 0000000000000..b3f735b03c530 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadClassifiersClient.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; + +/** An instance of this class provides access to all the operations defined in WorkloadClassifiersClient. */ +public interface WorkloadClassifiersClient { + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @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 workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadClassifierInner get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @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 workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @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 serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadGroupsClient.java new file mode 100644 index 0000000000000..db19279c0f13b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadGroupsClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; + +/** An instance of this class provides access to all the operations defined in WorkloadGroupsClient. */ +public interface WorkloadGroupsClient { + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadGroupInner get(String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters); + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context); + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters); + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context); + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @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 serverName, String databaseName, String workloadGroupName); + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..5860c47b1744d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A short term retention policy. */ +@JsonFlatten +@Fluent +public class BackupShortTermRetentionPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupShortTermRetentionPolicyInner.class); + + /* + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @param retentionDays the retentionDays value to set. + * @return the BackupShortTermRetentionPolicyInner object itself. + */ + public BackupShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..75cd8627668dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The result of a name availability check. */ +@Immutable +public final class CheckNameAvailabilityResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResponseInner.class); + + /* + * The name whose availability was checked. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * True if the name is available, otherwise false. + */ + @JsonProperty(value = "available", access = JsonProperty.Access.WRITE_ONLY) + private Boolean available; + + /* + * The reason code explaining why the name is unavailable. Will be + * undefined if the name is available. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private CheckNameAvailabilityReason reason; + + /* + * A message explaining why the name is unavailable. Will be undefined if + * the name is available. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the name property: The name whose availability was checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the available property: True if the name is available, otherwise false. + * + * @return the available value. + */ + public Boolean available() { + return this.available; + } + + /** + * Get the reason property: The reason code explaining why the name is unavailable. Will be undefined if the name is + * available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: A message explaining why the name is unavailable. Will be undefined if the name is + * available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java new file mode 100644 index 0000000000000..b4dd55a81eea7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database data masking policy. */ +@JsonFlatten +@Fluent +public class DataMaskingPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataMaskingPolicyInner.class); + + /* + * The location of the data masking policy. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The kind of data masking policy. Metadata, used for Azure portal. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * The state of the data masking policy. + */ + @JsonProperty(value = "properties.dataMaskingState") + private DataMaskingState dataMaskingState; + + /* + * The list of the exempt principals. Specifies the semicolon-separated + * list of database users for which the data masking policy does not apply. + * The specified users receive data results without masking for all of the + * database queries. + */ + @JsonProperty(value = "properties.exemptPrincipals") + private String exemptPrincipals; + + /* + * The list of the application principals. This is a legacy parameter and + * is no longer used. + */ + @JsonProperty(value = "properties.applicationPrincipals", access = JsonProperty.Access.WRITE_ONLY) + private String applicationPrincipals; + + /* + * The masking level. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "properties.maskingLevel", access = JsonProperty.Access.WRITE_ONLY) + private String maskingLevel; + + /** + * Get the location property: The location of the data masking policy. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: The kind of data masking policy. Metadata, used for Azure portal. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the dataMaskingState property: The state of the data masking policy. + * + * @return the dataMaskingState value. + */ + public DataMaskingState dataMaskingState() { + return this.dataMaskingState; + } + + /** + * Set the dataMaskingState property: The state of the data masking policy. + * + * @param dataMaskingState the dataMaskingState value to set. + * @return the DataMaskingPolicyInner object itself. + */ + public DataMaskingPolicyInner withDataMaskingState(DataMaskingState dataMaskingState) { + this.dataMaskingState = dataMaskingState; + return this; + } + + /** + * Get the exemptPrincipals property: The list of the exempt principals. Specifies the semicolon-separated list of + * database users for which the data masking policy does not apply. The specified users receive data results without + * masking for all of the database queries. + * + * @return the exemptPrincipals value. + */ + public String exemptPrincipals() { + return this.exemptPrincipals; + } + + /** + * Set the exemptPrincipals property: The list of the exempt principals. Specifies the semicolon-separated list of + * database users for which the data masking policy does not apply. The specified users receive data results without + * masking for all of the database queries. + * + * @param exemptPrincipals the exemptPrincipals value to set. + * @return the DataMaskingPolicyInner object itself. + */ + public DataMaskingPolicyInner withExemptPrincipals(String exemptPrincipals) { + this.exemptPrincipals = exemptPrincipals; + return this; + } + + /** + * Get the applicationPrincipals property: The list of the application principals. This is a legacy parameter and is + * no longer used. + * + * @return the applicationPrincipals value. + */ + public String applicationPrincipals() { + return this.applicationPrincipals; + } + + /** + * Get the maskingLevel property: The masking level. This is a legacy parameter and is no longer used. + * + * @return the maskingLevel value. + */ + public String maskingLevel() { + return this.maskingLevel; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.java new file mode 100644 index 0000000000000..04d80e7dece6f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.java @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database data masking rule. */ +@JsonFlatten +@Fluent +public class DataMaskingRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataMaskingRuleInner.class); + + /* + * The location of the data masking rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The kind of Data Masking Rule. Metadata, used for Azure portal. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * The rule Id. + */ + @JsonProperty(value = "properties.id", access = JsonProperty.Access.WRITE_ONLY) + private String idPropertiesId; + + /* + * The alias name. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "properties.aliasName") + private String aliasName; + + /* + * The rule state. Used to delete a rule. To delete an existing rule, + * specify the schemaName, tableName, columnName, maskingFunction, and + * specify ruleState as disabled. However, if the rule doesn't already + * exist, the rule will be created with ruleState set to enabled, + * regardless of the provided value of ruleState. + */ + @JsonProperty(value = "properties.ruleState") + private DataMaskingRuleState ruleState; + + /* + * The schema name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.schemaName") + private String schemaName; + + /* + * The table name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.tableName") + private String tableName; + + /* + * The column name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.columnName") + private String columnName; + + /* + * The masking function that is used for the data masking rule. + */ + @JsonProperty(value = "properties.maskingFunction") + private DataMaskingFunction maskingFunction; + + /* + * The numberFrom property of the masking rule. Required if maskingFunction + * is set to Number, otherwise this parameter will be ignored. + */ + @JsonProperty(value = "properties.numberFrom") + private String numberFrom; + + /* + * The numberTo property of the data masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be + * ignored. + */ + @JsonProperty(value = "properties.numberTo") + private String numberTo; + + /* + * If maskingFunction is set to Text, the number of characters to show + * unmasked in the beginning of the string. Otherwise, this parameter will + * be ignored. + */ + @JsonProperty(value = "properties.prefixSize") + private String prefixSize; + + /* + * If maskingFunction is set to Text, the number of characters to show + * unmasked at the end of the string. Otherwise, this parameter will be + * ignored. + */ + @JsonProperty(value = "properties.suffixSize") + private String suffixSize; + + /* + * If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + */ + @JsonProperty(value = "properties.replacementString") + private String replacementString; + + /** + * Get the location property: The location of the data masking rule. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: The kind of Data Masking Rule. Metadata, used for Azure portal. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the idPropertiesId property: The rule Id. + * + * @return the idPropertiesId value. + */ + public String idPropertiesId() { + return this.idPropertiesId; + } + + /** + * Get the aliasName property: The alias name. This is a legacy parameter and is no longer used. + * + * @return the aliasName value. + */ + public String aliasName() { + return this.aliasName; + } + + /** + * Set the aliasName property: The alias name. This is a legacy parameter and is no longer used. + * + * @param aliasName the aliasName value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withAliasName(String aliasName) { + this.aliasName = aliasName; + return this; + } + + /** + * Get the ruleState property: The rule state. Used to delete a rule. To delete an existing rule, specify the + * schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule + * doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value + * of ruleState. + * + * @return the ruleState value. + */ + public DataMaskingRuleState ruleState() { + return this.ruleState; + } + + /** + * Set the ruleState property: The rule state. Used to delete a rule. To delete an existing rule, specify the + * schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule + * doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value + * of ruleState. + * + * @param ruleState the ruleState value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withRuleState(DataMaskingRuleState ruleState) { + this.ruleState = ruleState; + return this; + } + + /** + * Get the schemaName property: The schema name on which the data masking rule is applied. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the schemaName property: The schema name on which the data masking rule is applied. + * + * @param schemaName the schemaName value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the tableName property: The table name on which the data masking rule is applied. + * + * @return the tableName value. + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the tableName property: The table name on which the data masking rule is applied. + * + * @param tableName the tableName value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the columnName property: The column name on which the data masking rule is applied. + * + * @return the columnName value. + */ + public String columnName() { + return this.columnName; + } + + /** + * Set the columnName property: The column name on which the data masking rule is applied. + * + * @param columnName the columnName value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withColumnName(String columnName) { + this.columnName = columnName; + return this; + } + + /** + * Get the maskingFunction property: The masking function that is used for the data masking rule. + * + * @return the maskingFunction value. + */ + public DataMaskingFunction maskingFunction() { + return this.maskingFunction; + } + + /** + * Set the maskingFunction property: The masking function that is used for the data masking rule. + * + * @param maskingFunction the maskingFunction value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withMaskingFunction(DataMaskingFunction maskingFunction) { + this.maskingFunction = maskingFunction; + return this; + } + + /** + * Get the numberFrom property: The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * + * @return the numberFrom value. + */ + public String numberFrom() { + return this.numberFrom; + } + + /** + * Set the numberFrom property: The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * + * @param numberFrom the numberFrom value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withNumberFrom(String numberFrom) { + this.numberFrom = numberFrom; + return this; + } + + /** + * Get the numberTo property: The numberTo property of the data masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * + * @return the numberTo value. + */ + public String numberTo() { + return this.numberTo; + } + + /** + * Set the numberTo property: The numberTo property of the data masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * + * @param numberTo the numberTo value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withNumberTo(String numberTo) { + this.numberTo = numberTo; + return this; + } + + /** + * Get the prefixSize property: If maskingFunction is set to Text, the number of characters to show unmasked in the + * beginning of the string. Otherwise, this parameter will be ignored. + * + * @return the prefixSize value. + */ + public String prefixSize() { + return this.prefixSize; + } + + /** + * Set the prefixSize property: If maskingFunction is set to Text, the number of characters to show unmasked in the + * beginning of the string. Otherwise, this parameter will be ignored. + * + * @param prefixSize the prefixSize value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withPrefixSize(String prefixSize) { + this.prefixSize = prefixSize; + return this; + } + + /** + * Get the suffixSize property: If maskingFunction is set to Text, the number of characters to show unmasked at the + * end of the string. Otherwise, this parameter will be ignored. + * + * @return the suffixSize value. + */ + public String suffixSize() { + return this.suffixSize; + } + + /** + * Set the suffixSize property: If maskingFunction is set to Text, the number of characters to show unmasked at the + * end of the string. Otherwise, this parameter will be ignored. + * + * @param suffixSize the suffixSize value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withSuffixSize(String suffixSize) { + this.suffixSize = suffixSize; + return this; + } + + /** + * Get the replacementString property: If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + * + * @return the replacementString value. + */ + public String replacementString() { + return this.replacementString; + } + + /** + * Set the replacementString property: If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + * + * @param replacementString the replacementString value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withReplacementString(String replacementString) { + this.replacementString = replacementString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.java new file mode 100644 index 0000000000000..9098f1bdca9ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Database-level Automatic Tuning. */ +@JsonFlatten +@Fluent +public class DatabaseAutomaticTuningInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAutomaticTuningInner.class); + + /* + * Automatic tuning desired state. + */ + @JsonProperty(value = "properties.desiredState") + private AutomaticTuningMode desiredState; + + /* + * Automatic tuning actual state. + */ + @JsonProperty(value = "properties.actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningMode actualState; + + /* + * Automatic tuning options definition. + */ + @JsonProperty(value = "properties.options") + private Map options; + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningMode desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning desired state. + * + * @param desiredState the desiredState value to set. + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withDesiredState(AutomaticTuningMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningMode actualState() { + return this.actualState; + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.options; + } + + /** + * Set the options property: Automatic tuning options definition. + * + * @param options the options value to set. + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withOptions(Map options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (options() != null) { + options() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..03443f712546c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** A database blob auditing policy. */ +@JsonFlatten +@Fluent +public class DatabaseBlobAuditingPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseBlobAuditingPolicyInner.class); + + /* + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "properties.state") + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the + * storageAccountAccessKey will use SQL server system-assigned managed + * identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding + * 'Storage Blob Data Contributor' RBAC role to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that in the above format can refer to an object like a + * table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /* + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'state' as + * 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + * + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647. + */ + @JsonProperty(value = "properties.queueDelayMs") + private Integer queueDelayMs; + + /** + * Get the kind property: Resource kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java new file mode 100644 index 0000000000000..4f1d3ed8f7fb3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java @@ -0,0 +1,1049 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.CurrentBackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.DatabaseReadScale; +import com.azure.resourcemanager.sql.generated.models.DatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.RequestedBackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** A database resource. */ +@JsonFlatten +@Fluent +public class DatabaseInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseInner.class); + + /* + * The database SKU. + * + * The list of SKUs may vary by region and support offer. To determine the + * SKUs (including the SKU name, tier/edition, family, and capacity) that + * are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + * ```azurecli + * az sql db list-editions -l -o table + * ```` + * + * ```powershell + * Get-AzSqlServerServiceObjective -Location + * ```` + * + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Kind of database. This is metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource that manages the database. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /* + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /* + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /* + * The name of the sample schema to apply when creating this database. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /* + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /* + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /* + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /* + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /* + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /* + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private OffsetDateTime sourceDatabaseDeletionDate; + + /* + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /* + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /* + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this database. `LicenseIncluded` if you + * need a license, or `BasePrice` if you have a license and are eligible + * for the Azure Hybrid Benefit. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /* + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /* + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /* + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /* + * The number of secondary replicas associated with the database that are + * used to provide high availability. + */ + @JsonProperty(value = "properties.highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /* + * The secondary type of the database if it is a secondary. Valid values + * are Geo and Named. + */ + @JsonProperty(value = "properties.secondaryType") + private SecondaryType secondaryType; + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /* + * Time in minutes after which database is automatically paused. A value of + * -1 means that automatic pause is disabled + */ + @JsonProperty(value = "properties.autoPauseDelay") + private Integer autoPauseDelay; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "properties.currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private CurrentBackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this database. + */ + @JsonProperty(value = "properties.requestedBackupStorageRedundancy") + private RequestedBackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Minimal capacity that database will always have allocated, if not paused + */ + @JsonProperty(value = "properties.minCapacity") + private Double minCapacity; + + /* + * The date when database was paused by user configuration or + * action(ISO8601 format). Null if the database is ready. + */ + @JsonProperty(value = "properties.pausedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime pausedDate; + + /* + * The date when database was resumed by user action or database login + * (ISO8601 format). Null if the database is paused. + */ + @JsonProperty(value = "properties.resumedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime resumedDate; + + /* + * Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will + * occur. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * Get the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * + * @param sku the sku value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the kind property: Kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the managedBy property: Resource that manages the database. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get the createMode property: Specifies the mode of database creation. + * + *

Default: regular database creation. + * + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource + * ID of the source database. + * + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be + * specified as the resource ID of the existing primary database. + * + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be + * specified. + * + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the + * recoverable database resource ID to restore. + * + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. + * If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. + * Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is + * ignored. restorePointInTime may also be specified to restore from an earlier point in time. + * + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + * + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Specifies the mode of database creation. + * + *

Default: regular database creation. + * + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource + * ID of the source database. + * + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be + * specified as the resource ID of the existing primary database. + * + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be + * specified. + * + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the + * recoverable database resource ID to restore. + * + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. + * If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. + * Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is + * ignored. restorePointInTime may also be specified to restore from an earlier point in time. + * + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + * + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. + * + * @param createMode the createMode value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the sampleName property: The name of the sample schema to apply when creating this database. + * + * @param sampleName the sampleName value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value. + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: The resource identifier of the long term retention backup + * associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value. + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the longTermRetentionBackupResourceId property: The resource identifier of the long term retention backup + * associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the zoneRedundant property: Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant property: Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @param licenseType the licenseType value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the readScale property: The state of read-only routing. If enabled, connections that have application intent + * set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the readScale property: The state of read-only routing. If enabled, connections that have application intent + * set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + * + * @param readScale the readScale value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Get the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo and + * Named. + * + * @return the secondaryType value. + */ + public SecondaryType secondaryType() { + return this.secondaryType; + } + + /** + * Set the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo and + * Named. + * + * @param secondaryType the secondaryType value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSecondaryType(SecondaryType secondaryType) { + this.secondaryType = secondaryType; + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * Get the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + public Integer autoPauseDelay() { + return this.autoPauseDelay; + } + + /** + * Set the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @param autoPauseDelay the autoPauseDelay value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withAutoPauseDelay(Integer autoPauseDelay) { + this.autoPauseDelay = autoPauseDelay; + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public CurrentBackupStorageRedundancy currentBackupStorageRedundancy() { + return this.currentBackupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public RequestedBackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRequestedBackupStorageRedundancy( + RequestedBackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Get the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @param minCapacity the minCapacity value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + public OffsetDateTime pausedDate() { + return this.pausedDate; + } + + /** + * Get the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + public OffsetDateTime resumedDate() { + return this.resumedDate; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (currentSku() != null) { + currentSku().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.java new file mode 100644 index 0000000000000..99098d0c026a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A database operation. */ +@JsonFlatten +@Immutable +public class DatabaseOperationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseOperationInner.class); + + /* + * The name of the database the operation is being performed on. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The name of operation. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "properties.operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "properties.errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "properties.isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "properties.estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "properties.isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** + * Get the databaseName property: The name of the database the operation is being performed on. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..0d5e11acac3c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyEmailAccountAdmins; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyUseServerDefault; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains information about a database Threat Detection policy. */ +@JsonFlatten +@Fluent +public class DatabaseSecurityAlertPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseSecurityAlertPolicyInner.class); + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * and storageAccountAccessKey are required. + */ + @JsonProperty(value = "properties.state") + private SecurityAlertPolicyState state; + + /* + * Specifies the semicolon-separated list of alerts that are disabled, or + * empty string to disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; + * Unsafe_Action. + */ + @JsonProperty(value = "properties.disabledAlerts") + private String disabledAlerts; + + /* + * Specifies the semicolon-separated list of e-mail addresses to which the + * alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private String emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. If state is Enabled, storageEndpoint is + * required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies whether to use the default server policy. + */ + @JsonProperty(value = "properties.useServerDefault") + private SecurityAlertPolicyUseServerDefault useServerDefault; + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the kind property: Resource kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint and + * storageAccountAccessKey are required. + * + * @return the state value. + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint and + * storageAccountAccessKey are required. + * + * @param state the state value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies the semicolon-separated list of alerts that are disabled, or empty + * string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; + * Data_Exfiltration; Unsafe_Action. + * + * @return the disabledAlerts value. + */ + public String disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies the semicolon-separated list of alerts that are disabled, or empty + * string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; + * Data_Exfiltration; Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withDisabledAlerts(String disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies the semicolon-separated list of e-mail addresses to which the alert is + * sent. + * + * @return the emailAddresses value. + */ + public String emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies the semicolon-separated list of e-mail addresses to which the alert is + * sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAddresses(String emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAccountAdmins( + SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state + * is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state + * is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the useServerDefault property: Specifies whether to use the default server policy. + * + * @return the useServerDefault value. + */ + public SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.useServerDefault; + } + + /** + * Set the useServerDefault property: Specifies whether to use the default server policy. + * + * @param useServerDefault the useServerDefault value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.useServerDefault = useServerDefault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.java new file mode 100644 index 0000000000000..87f65ffa73b1e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The database usages. */ +@Immutable +public final class DatabaseUsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseUsageInner.class); + + /* + * The name of the usage metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The name of the resource. + */ + @JsonProperty(value = "resourceName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceName; + + /* + * The usage metric display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The current value of the usage metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * The current limit of the usage metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * The units of the usage metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * The next reset time for the usage metric (ISO8601 format). + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime nextResetTime; + + /** + * Get the name property: The name of the usage metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the resourceName property: The name of the resource. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the displayName property: The usage metric display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the currentValue property: The current value of the usage metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: The current limit of the usage metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: The units of the usage metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the nextResetTime property: The next reset time for the usage metric (ISO8601 format). + * + * @return the nextResetTime value. + */ + public OffsetDateTime nextResetTime() { + return this.nextResetTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..b0ac4b1c2e5e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database vulnerability assessment. */ +@JsonFlatten +@Fluent +public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentInner.class); + + /* + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if + * server level vulnerability assessment policy doesn't set + */ + @JsonProperty(value = "properties.storageContainerPath") + private String storageContainerPath; + + /* + * A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + * required. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /* + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy + * doesn't set. + * + * @return the storageContainerPath value. + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy + * doesn't set. + * + * @param storageContainerPath the storageContainerPath value to set. + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recurringScans() != null) { + recurringScans().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..687e3a2b652a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A database vulnerability assessment rule baseline. */ +@JsonFlatten +@Fluent +public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselineInner.class); + + /* + * The rule baseline result + */ + @JsonProperty(value = "properties.baselineResults") + private List baselineResults; + + /** + * Get the baselineResults property: The rule baseline result. + * + * @return the baselineResults value. + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the baselineResults property: The rule baseline result. + * + * @param baselineResults the baselineResults value to set. + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults( + List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (baselineResults() != null) { + baselineResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.java new file mode 100644 index 0000000000000..6eb92eb00b593 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database Vulnerability Assessment scan export resource. */ +@JsonFlatten +@Immutable +public class DatabaseVulnerabilityAssessmentScansExportInner extends ProxyResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentScansExportInner.class); + + /* + * Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + @JsonProperty(value = "properties.exportedReportLocation", access = JsonProperty.Access.WRITE_ONLY) + private String exportedReportLocation; + + /** + * Get the exportedReportLocation property: Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + * + * @return the exportedReportLocation value. + */ + public String exportedReportLocation() { + return this.exportedReportLocation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.java new file mode 100644 index 0000000000000..9bbb26783dc94 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the activity on an elastic pool. */ +@JsonFlatten +@Fluent +public class ElasticPoolActivityInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolActivityInner.class); + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /* + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The requested max DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMax", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMax; + + /* + * The requested min DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMin", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMin; + + /* + * The requested DTU for the pool if available. + */ + @JsonProperty(value = "properties.requestedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtu; + + /* + * The requested name for the elastic pool if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /* + * The requested storage limit for the pool in GB if available. + */ + @JsonProperty(value = "properties.requestedStorageLimitInGB", access = JsonProperty.Access.WRITE_ONLY) + private Long requestedStorageLimitInGB; + + /* + * The name of the elastic pool. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The requested storage limit in MB. + */ + @JsonProperty(value = "properties.requestedStorageLimitInMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedStorageLimitInMB; + + /* + * The requested per database DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuGuarantee; + + /* + * The requested per database DTU cap. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuCap", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuCap; + + /* + * The requested DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtuGuarantee; + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the ElasticPoolActivityInner object itself. + */ + public ElasticPoolActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the requestedDatabaseDtuMax property: The requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value. + */ + public Integer requestedDatabaseDtuMax() { + return this.requestedDatabaseDtuMax; + } + + /** + * Get the requestedDatabaseDtuMin property: The requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value. + */ + public Integer requestedDatabaseDtuMin() { + return this.requestedDatabaseDtuMin; + } + + /** + * Get the requestedDtu property: The requested DTU for the pool if available. + * + * @return the requestedDtu value. + */ + public Integer requestedDtu() { + return this.requestedDtu; + } + + /** + * Get the requestedElasticPoolName property: The requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value. + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the requestedStorageLimitInGB property: The requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value. + */ + public Long requestedStorageLimitInGB() { + return this.requestedStorageLimitInGB; + } + + /** + * Get the elasticPoolName property: The name of the elastic pool. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the requestedStorageLimitInMB property: The requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value. + */ + public Integer requestedStorageLimitInMB() { + return this.requestedStorageLimitInMB; + } + + /** + * Get the requestedDatabaseDtuGuarantee property: The requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value. + */ + public Integer requestedDatabaseDtuGuarantee() { + return this.requestedDatabaseDtuGuarantee; + } + + /** + * Get the requestedDatabaseDtuCap property: The requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value. + */ + public Integer requestedDatabaseDtuCap() { + return this.requestedDatabaseDtuCap; + } + + /** + * Get the requestedDtuGuarantee property: The requested DTU guarantee. + * + * @return the requestedDtuGuarantee value. + */ + public Integer requestedDtuGuarantee() { + return this.requestedDtuGuarantee; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java new file mode 100644 index 0000000000000..f12e8cfc2b956 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the activity on an elastic pool. */ +@JsonFlatten +@Fluent +public class ElasticPoolDatabaseActivityInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolDatabaseActivityInner.class); + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * The database name. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /* + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name for the elastic pool the database is moving into if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /* + * The name of the current elastic pool the database is in if available. + */ + @JsonProperty(value = "properties.currentElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String currentElasticPoolName; + + /* + * The name of the current service objective if available. + */ + @JsonProperty(value = "properties.currentServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjective; + + /* + * The name of the requested service objective if available. + */ + @JsonProperty(value = "properties.requestedServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjective; + + /* + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the ElasticPoolDatabaseActivityInner object itself. + */ + public ElasticPoolDatabaseActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the databaseName property: The database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the requestedElasticPoolName property: The name for the elastic pool the database is moving into if + * available. + * + * @return the requestedElasticPoolName value. + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the currentElasticPoolName property: The name of the current elastic pool the database is in if available. + * + * @return the currentElasticPoolName value. + */ + public String currentElasticPoolName() { + return this.currentElasticPoolName; + } + + /** + * Get the currentServiceObjective property: The name of the current service objective if available. + * + * @return the currentServiceObjective value. + */ + public String currentServiceObjective() { + return this.currentServiceObjective; + } + + /** + * Get the requestedServiceObjective property: The name of the requested service objective if available. + * + * @return the requestedServiceObjective value. + */ + public String requestedServiceObjective() { + return this.requestedServiceObjective; + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.java new file mode 100644 index 0000000000000..837d2bfa0451a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolState; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An elastic pool. */ +@JsonFlatten +@Fluent +public class ElasticPoolInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolInner.class); + + /* + * The elastic pool SKU. + * + * The list of SKUs may vary by region and support offer. To determine the + * SKUs (including the SKU name, tier/edition, family, and capacity) that + * are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + * ```azurecli + * az sql elastic-pool list-editions -l -o table + * ```` + * + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Kind of elastic pool. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * The state of the elastic pool. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /* + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /* + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /* + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this elastic pool. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /* + * Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will + * occur. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * Get the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * + * @param sku the sku value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the kind property: Kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the state property: The state of the elastic pool. + * + * @return the state value. + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the creationDate property: The creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get the zoneRedundant property: Whether or not this elastic pool is zone redundant, which means the replicas of + * this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant property: Whether or not this elastic pool is zone redundant, which means the replicas of + * this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this elastic pool. + * + * @param licenseType the licenseType value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ElasticPoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ElasticPoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (perDatabaseSettings() != null) { + perDatabaseSettings().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.java new file mode 100644 index 0000000000000..64dce26b814e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A elastic pool operation. */ +@JsonFlatten +@Immutable +public class ElasticPoolOperationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolOperationInner.class); + + /* + * The name of the elastic pool the operation is being performed on. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The name of operation. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "properties.operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The operation error code. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "properties.errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "properties.isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "properties.estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "properties.isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** + * Get the elasticPoolName property: The name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.java new file mode 100644 index 0000000000000..d52ca4864d2a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The server encryption protector. */ +@JsonFlatten +@Fluent +public class EncryptionProtectorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionProtectorInner.class); + + /* + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Subregion of the encryption protector. + */ + @JsonProperty(value = "properties.subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /* + * The name of the server key. + */ + @JsonProperty(value = "properties.serverKeyName") + private String serverKeyName; + + /* + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType") + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * Get the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the subregion property: Subregion of the encryption protector. + * + * @return the subregion value. + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the serverKeyName property: The name of the server key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the serverKeyName property: The name of the server key. + * + * @param serverKeyName the serverKeyName value to set. + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..2caac0f7de2a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An extended database blob auditing policy. */ +@JsonFlatten +@Fluent +public class ExtendedDatabaseBlobAuditingPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedDatabaseBlobAuditingPolicyInner.class); + + /* + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "properties.predicateExpression") + private String predicateExpression; + + /* + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "properties.state") + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the + * storageAccountAccessKey will use SQL server system-assigned managed + * identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding + * 'Storage Blob Data Contributor' RBAC role to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that in the above format can refer to an object like a + * table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /* + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'state' as + * 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + * + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647. + */ + @JsonProperty(value = "properties.queueDelayMs") + private Integer queueDelayMs; + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled( + Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..376dfef55a35c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An extended server blob auditing policy. */ +@JsonFlatten +@Fluent +public class ExtendedServerBlobAuditingPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedServerBlobAuditingPolicyInner.class); + + /* + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "properties.predicateExpression") + private String predicateExpression; + + /* + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "properties.state") + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the + * storageAccountAccessKey will use SQL server system-assigned managed + * identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding + * 'Storage Blob Data Contributor' RBAC role to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that in the above format can refer to an object like a + * table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /* + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'state' as + * 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + * + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647. + */ + @JsonProperty(value = "properties.queueDelayMs") + private Integer queueDelayMs; + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.java new file mode 100644 index 0000000000000..86be501ddf8d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A failover group. */ +@JsonFlatten +@Fluent +public class FailoverGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverGroupInner.class); + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint") + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * Local replication role of the failover group instance. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /* + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /* + * List of partner server information for the failover group. + */ + @JsonProperty(value = "properties.partnerServers") + private List partnerServers; + + /* + * List of databases in the failover group. + */ + @JsonProperty(value = "properties.databases") + private List databases; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * 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 FailoverGroupInner object itself. + */ + public FailoverGroupInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set. + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set. + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get the partnerServers property: List of partner server information for the failover group. + * + * @return the partnerServers value. + */ + public List partnerServers() { + return this.partnerServers; + } + + /** + * Set the partnerServers property: List of partner server information for the failover group. + * + * @param partnerServers the partnerServers value to set. + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withPartnerServers(List partnerServers) { + this.partnerServers = partnerServers; + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.databases; + } + + /** + * Set the databases property: List of databases in the failover group. + * + * @param databases the databases value to set. + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withDatabases(List databases) { + this.databases = databases; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readWriteEndpoint() != null) { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + if (partnerServers() != null) { + partnerServers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.java new file mode 100644 index 0000000000000..1f3d6228bd190 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a server firewall rule. */ +@JsonFlatten +@Fluent +public class FirewallRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleInner.class); + + /* + * Kind of server that contains this firewall rule. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The start IP address of the firewall rule. Must be IPv4 format. Use + * value '0.0.0.0' to represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.startIpAddress") + private String startIpAddress; + + /* + * The end IP address of the firewall rule. Must be IPv4 format. Must be + * greater than or equal to startIpAddress. Use value '0.0.0.0' to + * represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.endIpAddress") + private String endIpAddress; + + /** + * Get the kind property: Kind of server that contains this firewall rule. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the location property: Location of the server that contains this firewall rule. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. Use value + * '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. Use value + * '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress property: The end IP address of the firewall rule. Must be IPv4 format. Must be greater than + * or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the endIpAddress property: The end IP address of the firewall rule. Must be IPv4 format. Must be greater than + * or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.java new file mode 100644 index 0000000000000..aa070a15d982c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database geo backup policy. */ +@JsonFlatten +@Fluent +public class GeoBackupPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GeoBackupPolicyInner.class); + + /* + * Kind of geo backup policy. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Backup policy location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The state of the geo backup policy. + */ + @JsonProperty(value = "properties.state", required = true) + private GeoBackupPolicyState state; + + /* + * The storage type of the geo backup policy. + */ + @JsonProperty(value = "properties.storageType", access = JsonProperty.Access.WRITE_ONLY) + private String storageType; + + /** + * Get the kind property: Kind of geo backup policy. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the location property: Backup policy location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the state property: The state of the geo backup policy. + * + * @return the state value. + */ + public GeoBackupPolicyState state() { + return this.state; + } + + /** + * Set the state property: The state of the geo backup policy. + * + * @param state the state value to set. + * @return the GeoBackupPolicyInner object itself. + */ + public GeoBackupPolicyInner withState(GeoBackupPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageType property: The storage type of the geo backup policy. + * + * @return the storageType value. + */ + public String storageType() { + return this.storageType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property state in model GeoBackupPolicyInner")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.java new file mode 100644 index 0000000000000..adec1b37343c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionRequestStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An ImportExport operation result resource. */ +@JsonFlatten +@Immutable +public class ImportExportOperationResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImportExportOperationResultInner.class); + + /* + * Request Id. + */ + @JsonProperty(value = "properties.requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Request type. + */ + @JsonProperty(value = "properties.requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /* + * Queued time. + */ + @JsonProperty(value = "properties.queuedTime", access = JsonProperty.Access.WRITE_ONLY) + private String queuedTime; + + /* + * Last modified time. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /* + * Blob Uri. + */ + @JsonProperty(value = "properties.blobUri", access = JsonProperty.Access.WRITE_ONLY) + private String blobUri; + + /* + * Server name. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * Operation status. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Error message. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * Gets the status of private endpoints associated with this request. + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the requestType property: Request type. + * + * @return the requestType value. + */ + public String requestType() { + return this.requestType; + } + + /** + * Get the queuedTime property: Queued time. + * + * @return the queuedTime value. + */ + public String queuedTime() { + return this.queuedTime; + } + + /** + * Get the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the blobUri property: Blob Uri. + * + * @return the blobUri value. + */ + public String blobUri() { + return this.blobUri; + } + + /** + * Get the serverName property: Server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName property: Database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the privateEndpointConnections property: Gets the status of private endpoints associated with this request. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.java new file mode 100644 index 0000000000000..b3f120ed1adde --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An instance failover group. */ +@JsonFlatten +@Fluent +public class InstanceFailoverGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceFailoverGroupInner.class); + + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint") + private InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * Local replication role of the failover group instance. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /* + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /* + * Partner region information for the failover group. + */ + @JsonProperty(value = "properties.partnerRegions") + private List partnerRegions; + + /* + * List of managed instance pairs in the failover group. + */ + @JsonProperty(value = "properties.managedInstancePairs") + private List managedInstancePairs; + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set. + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set. + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get the partnerRegions property: Partner region information for the failover group. + * + * @return the partnerRegions value. + */ + public List partnerRegions() { + return this.partnerRegions; + } + + /** + * Set the partnerRegions property: Partner region information for the failover group. + * + * @param partnerRegions the partnerRegions value to set. + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withPartnerRegions(List partnerRegions) { + this.partnerRegions = partnerRegions; + return this; + } + + /** + * Get the managedInstancePairs property: List of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value. + */ + public List managedInstancePairs() { + return this.managedInstancePairs; + } + + /** + * Set the managedInstancePairs property: List of managed instance pairs in the failover group. + * + * @param managedInstancePairs the managedInstancePairs value to set. + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withManagedInstancePairs(List managedInstancePairs) { + this.managedInstancePairs = managedInstancePairs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readWriteEndpoint() != null) { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + if (partnerRegions() != null) { + partnerRegions().forEach(e -> e.validate()); + } + if (managedInstancePairs() != null) { + managedInstancePairs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.java new file mode 100644 index 0000000000000..44fbb7f21eac0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure SQL instance pool. */ +@JsonFlatten +@Fluent +public class InstancePoolInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstancePoolInner.class); + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource ID of the subnet to place this instance pool in. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /* + * Count of vCores belonging to this instance pool. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /* + * The license type. Possible values are 'LicenseIncluded' (price for SQL + * license is included) and 'BasePrice' (without SQL license price). + */ + @JsonProperty(value = "properties.licenseType") + private InstancePoolLicenseType licenseType; + + /** + * Get the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The name and tier of the SKU. + * + * @param sku the sku value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @param subnetId the subnetId value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the vCores property: Count of vCores belonging to this instance pool. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores property: Count of vCores belonging to this instance pool. + * + * @param vCores the vCores value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @return the licenseType value. + */ + public InstancePoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @param licenseType the licenseType value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withLicenseType(InstancePoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** {@inheritDoc} */ + @Override + public InstancePoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public InstancePoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.java new file mode 100644 index 0000000000000..e9c295e6a8b1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobAgentState; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure SQL job agent. */ +@JsonFlatten +@Fluent +public class JobAgentInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobAgentInner.class); + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource ID of the database to store job metadata in. + */ + @JsonProperty(value = "properties.databaseId") + private String databaseId; + + /* + * The state of the job agent. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private JobAgentState state; + + /** + * Get the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The name and tier of the SKU. + * + * @param sku the sku value to set. + * @return the JobAgentInner object itself. + */ + public JobAgentInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the databaseId property: Resource ID of the database to store job metadata in. + * + * @return the databaseId value. + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Set the databaseId property: Resource ID of the database to store job metadata in. + * + * @param databaseId the databaseId value to set. + * @return the JobAgentInner object itself. + */ + public JobAgentInner withDatabaseId(String databaseId) { + this.databaseId = databaseId; + return this; + } + + /** + * Get the state property: The state of the job agent. + * + * @return the state value. + */ + public JobAgentState state() { + return this.state; + } + + /** {@inheritDoc} */ + @Override + public JobAgentInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public JobAgentInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.java new file mode 100644 index 0000000000000..5ebae23e58503 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A stored credential that can be used by a job to connect to target databases. */ +@JsonFlatten +@Fluent +public class JobCredentialInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCredentialInner.class); + + /* + * The credential user name. + */ + @JsonProperty(value = "properties.username") + private String username; + + /* + * The credential password. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * Get the username property: The credential user name. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The credential user name. + * + * @param username the username value to set. + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The credential password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The credential password. + * + * @param password the password value to set. + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.java new file mode 100644 index 0000000000000..8ef29242d111b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobExecutionLifecycle; +import com.azure.resourcemanager.sql.generated.models.JobExecutionTarget; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An execution of a job. */ +@JsonFlatten +@Fluent +public class JobExecutionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobExecutionInner.class); + + /* + * The job version number. + */ + @JsonProperty(value = "properties.jobVersion", access = JsonProperty.Access.WRITE_ONLY) + private Integer jobVersion; + + /* + * The job step name. + */ + @JsonProperty(value = "properties.stepName", access = JsonProperty.Access.WRITE_ONLY) + private String stepName; + + /* + * The job step id. + */ + @JsonProperty(value = "properties.stepId", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepId; + + /* + * The unique identifier of the job execution. + */ + @JsonProperty(value = "properties.jobExecutionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID jobExecutionId; + + /* + * The detailed state of the job execution. + */ + @JsonProperty(value = "properties.lifecycle", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionLifecycle lifecycle; + + /* + * The ARM provisioning state of the job execution. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The time that the job execution was created. + */ + @JsonProperty(value = "properties.createTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createTime; + + /* + * The time that the job execution started. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The time that the job execution completed. + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * Number of times the job execution has been attempted. + */ + @JsonProperty(value = "properties.currentAttempts") + private Integer currentAttempts; + + /* + * Start time of the current attempt. + */ + @JsonProperty(value = "properties.currentAttemptStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime currentAttemptStartTime; + + /* + * The last status or error message. + */ + @JsonProperty(value = "properties.lastMessage", access = JsonProperty.Access.WRITE_ONLY) + private String lastMessage; + + /* + * The target that this execution is executed on. + */ + @JsonProperty(value = "properties.target", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionTarget target; + + /** + * Get the jobVersion property: The job version number. + * + * @return the jobVersion value. + */ + public Integer jobVersion() { + return this.jobVersion; + } + + /** + * Get the stepName property: The job step name. + * + * @return the stepName value. + */ + public String stepName() { + return this.stepName; + } + + /** + * Get the stepId property: The job step id. + * + * @return the stepId value. + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Get the jobExecutionId property: The unique identifier of the job execution. + * + * @return the jobExecutionId value. + */ + public UUID jobExecutionId() { + return this.jobExecutionId; + } + + /** + * Get the lifecycle property: The detailed state of the job execution. + * + * @return the lifecycle value. + */ + public JobExecutionLifecycle lifecycle() { + return this.lifecycle; + } + + /** + * Get the provisioningState property: The ARM provisioning state of the job execution. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the createTime property: The time that the job execution was created. + * + * @return the createTime value. + */ + public OffsetDateTime createTime() { + return this.createTime; + } + + /** + * Get the startTime property: The time that the job execution started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The time that the job execution completed. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the currentAttempts property: Number of times the job execution has been attempted. + * + * @return the currentAttempts value. + */ + public Integer currentAttempts() { + return this.currentAttempts; + } + + /** + * Set the currentAttempts property: Number of times the job execution has been attempted. + * + * @param currentAttempts the currentAttempts value to set. + * @return the JobExecutionInner object itself. + */ + public JobExecutionInner withCurrentAttempts(Integer currentAttempts) { + this.currentAttempts = currentAttempts; + return this; + } + + /** + * Get the currentAttemptStartTime property: Start time of the current attempt. + * + * @return the currentAttemptStartTime value. + */ + public OffsetDateTime currentAttemptStartTime() { + return this.currentAttemptStartTime; + } + + /** + * Get the lastMessage property: The last status or error message. + * + * @return the lastMessage value. + */ + public String lastMessage() { + return this.lastMessage; + } + + /** + * Get the target property: The target that this execution is executed on. + * + * @return the target value. + */ + public JobExecutionTarget target() { + return this.target; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (target() != null) { + target().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.java new file mode 100644 index 0000000000000..208c68bed305d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A job. */ +@JsonFlatten +@Fluent +public class JobInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobInner.class); + + /* + * User-defined description of the job. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The job version number. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /* + * Schedule properties of the job. + */ + @JsonProperty(value = "properties.schedule") + private JobSchedule schedule; + + /** + * Get the description property: User-defined description of the job. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User-defined description of the job. + * + * @param description the description value to set. + * @return the JobInner object itself. + */ + public JobInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the version property: The job version number. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Get the schedule property: Schedule properties of the job. + * + * @return the schedule value. + */ + public JobSchedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: Schedule properties of the job. + * + * @param schedule the schedule value to set. + * @return the JobInner object itself. + */ + public JobInner withSchedule(JobSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schedule() != null) { + schedule().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.java new file mode 100644 index 0000000000000..d1626944fb1d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A job step. */ +@JsonFlatten +@Fluent +public class JobStepInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStepInner.class); + + /* + * The job step's index within the job. If not specified when creating the + * job step, it will be created as the last step. If not specified when + * updating the job step, the step id is not modified. + */ + @JsonProperty(value = "properties.stepId") + private Integer stepId; + + /* + * The resource ID of the target group that the job step will be executed + * on. + */ + @JsonProperty(value = "properties.targetGroup") + private String targetGroup; + + /* + * The resource ID of the job credential that will be used to connect to + * the targets. + */ + @JsonProperty(value = "properties.credential") + private String credential; + + /* + * The action payload of the job step. + */ + @JsonProperty(value = "properties.action") + private JobStepAction action; + + /* + * Output destination properties of the job step. + */ + @JsonProperty(value = "properties.output") + private JobStepOutput output; + + /* + * Execution options for the job step. + */ + @JsonProperty(value = "properties.executionOptions") + private JobStepExecutionOptions executionOptions; + + /** + * Get the stepId property: The job step's index within the job. If not specified when creating the job step, it + * will be created as the last step. If not specified when updating the job step, the step id is not modified. + * + * @return the stepId value. + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Set the stepId property: The job step's index within the job. If not specified when creating the job step, it + * will be created as the last step. If not specified when updating the job step, the step id is not modified. + * + * @param stepId the stepId value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withStepId(Integer stepId) { + this.stepId = stepId; + return this; + } + + /** + * Get the targetGroup property: The resource ID of the target group that the job step will be executed on. + * + * @return the targetGroup value. + */ + public String targetGroup() { + return this.targetGroup; + } + + /** + * Set the targetGroup property: The resource ID of the target group that the job step will be executed on. + * + * @param targetGroup the targetGroup value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withTargetGroup(String targetGroup) { + this.targetGroup = targetGroup; + return this; + } + + /** + * Get the credential property: The resource ID of the job credential that will be used to connect to the targets. + * + * @return the credential value. + */ + public String credential() { + return this.credential; + } + + /** + * Set the credential property: The resource ID of the job credential that will be used to connect to the targets. + * + * @param credential the credential value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withCredential(String credential) { + this.credential = credential; + return this; + } + + /** + * Get the action property: The action payload of the job step. + * + * @return the action value. + */ + public JobStepAction action() { + return this.action; + } + + /** + * Set the action property: The action payload of the job step. + * + * @param action the action value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withAction(JobStepAction action) { + this.action = action; + return this; + } + + /** + * Get the output property: Output destination properties of the job step. + * + * @return the output value. + */ + public JobStepOutput output() { + return this.output; + } + + /** + * Set the output property: Output destination properties of the job step. + * + * @param output the output value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withOutput(JobStepOutput output) { + this.output = output; + return this; + } + + /** + * Get the executionOptions property: Execution options for the job step. + * + * @return the executionOptions value. + */ + public JobStepExecutionOptions executionOptions() { + return this.executionOptions; + } + + /** + * Set the executionOptions property: Execution options for the job step. + * + * @param executionOptions the executionOptions value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.executionOptions = executionOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (action() != null) { + action().validate(); + } + if (output() != null) { + output().validate(); + } + if (executionOptions() != null) { + executionOptions().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.java new file mode 100644 index 0000000000000..bfa3d71ce3311 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A group of job targets. */ +@JsonFlatten +@Fluent +public class JobTargetGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobTargetGroupInner.class); + + /* + * Members of the target group. + */ + @JsonProperty(value = "properties.members") + private List members; + + /** + * Get the members property: Members of the target group. + * + * @return the members value. + */ + public List members() { + return this.members; + } + + /** + * Set the members property: Members of the target group. + * + * @param members the members value to set. + * @return the JobTargetGroupInner object itself. + */ + public JobTargetGroupInner withMembers(List members) { + this.members = members; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (members() != null) { + members().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java new file mode 100644 index 0000000000000..4a9962b426cd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** A job version. */ +@Immutable +public final class JobVersionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobVersionInner.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.java new file mode 100644 index 0000000000000..6f1f174ec4357 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.CapabilityStatus; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVersionCapability; +import com.azure.resourcemanager.sql.generated.models.ServerVersionCapability; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The location capability. */ +@Fluent +public final class LocationCapabilitiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationCapabilitiesInner.class); + + /* + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The list of supported server versions. + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerVersions; + + /* + * The list of supported managed instance versions. + */ + @JsonProperty(value = "supportedManagedInstanceVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedManagedInstanceVersions; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The location name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedServerVersions property: The list of supported server versions. + * + * @return the supportedServerVersions value. + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Get the supportedManagedInstanceVersions property: The list of supported managed instance versions. + * + * @return the supportedManagedInstanceVersions value. + */ + public List supportedManagedInstanceVersions() { + return this.supportedManagedInstanceVersions; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the LocationCapabilitiesInner object itself. + */ + public LocationCapabilitiesInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedServerVersions() != null) { + supportedServerVersions().forEach(e -> e.validate()); + } + if (supportedManagedInstanceVersions() != null) { + supportedManagedInstanceVersions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.java new file mode 100644 index 0000000000000..64dd7fb161985 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A long term retention backup. */ +@JsonFlatten +@Fluent +public class LongTermRetentionBackupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionBackupInner.class); + + /* + * The server name that the backup database belong to. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The create time of the server. + */ + @JsonProperty(value = "properties.serverCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime serverCreateTime; + + /* + * The name of the database the backup belong to + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The delete time of the database + */ + @JsonProperty(value = "properties.databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime databaseDeletionTime; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "properties.backupTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupTime; + + /* + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "properties.backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupExpirationTime; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "properties.backupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy backupStorageRedundancy; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "properties.requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /** + * Get the serverName property: The server name that the backup database belong to. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the serverCreateTime property: The create time of the server. + * + * @return the serverCreateTime value. + */ + public OffsetDateTime serverCreateTime() { + return this.serverCreateTime; + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.databaseDeletionTime; + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.backupTime; + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.backupExpirationTime; + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.backupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the LongTermRetentionBackupInner object itself. + */ + public LongTermRetentionBackupInner withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.java new file mode 100644 index 0000000000000..0730c216bcd73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** A LongTermRetentionBackup operation result resource. */ +@JsonFlatten +@Immutable +public class LongTermRetentionBackupOperationResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionBackupOperationResultInner.class); + + /* + * Request Id. + */ + @JsonProperty(value = "properties.requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Operation type. + */ + @JsonProperty(value = "properties.operationType", access = JsonProperty.Access.WRITE_ONLY) + private String operationType; + + /* + * Source backup resource id + */ + @JsonProperty(value = "properties.fromBackupResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String fromBackupResourceId; + + /* + * Target backup resource id + */ + @JsonProperty(value = "properties.toBackupResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String toBackupResourceId; + + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "properties.targetBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy targetBackupStorageRedundancy; + + /* + * Operation status + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Progress message + */ + @JsonProperty(value = "properties.message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the operationType property: Operation type. + * + * @return the operationType value. + */ + public String operationType() { + return this.operationType; + } + + /** + * Get the fromBackupResourceId property: Source backup resource id. + * + * @return the fromBackupResourceId value. + */ + public String fromBackupResourceId() { + return this.fromBackupResourceId; + } + + /** + * Get the toBackupResourceId property: Target backup resource id. + * + * @return the toBackupResourceId value. + */ + public String toBackupResourceId() { + return this.toBackupResourceId; + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.targetBackupStorageRedundancy; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the message property: Progress message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..8d4bf93d402b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionPolicyInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A long term retention policy. */ +@JsonFlatten +@Fluent +public class LongTermRetentionPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionPolicyInner.class); + + /* + * The weekly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weeklyRetention") + private String weeklyRetention; + + /* + * The monthly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.monthlyRetention") + private String monthlyRetention; + + /* + * The yearly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.yearlyRetention") + private String yearlyRetention; + + /* + * The week of year to take the yearly backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weekOfYear") + private Integer weekOfYear; + + /** + * Get the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + public String weeklyRetention() { + return this.weeklyRetention; + } + + /** + * Set the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @param weeklyRetention the weeklyRetention value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withWeeklyRetention(String weeklyRetention) { + this.weeklyRetention = weeklyRetention; + return this; + } + + /** + * Get the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + public String monthlyRetention() { + return this.monthlyRetention; + } + + /** + * Set the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @param monthlyRetention the monthlyRetention value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withMonthlyRetention(String monthlyRetention) { + this.monthlyRetention = monthlyRetention; + return this; + } + + /** + * Get the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + public String yearlyRetention() { + return this.yearlyRetention; + } + + /** + * Set the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @param yearlyRetention the yearlyRetention value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withYearlyRetention(String yearlyRetention) { + this.yearlyRetention = yearlyRetention; + return this; + } + + /** + * Get the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + public Integer weekOfYear() { + return this.weekOfYear; + } + + /** + * Set the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @param weekOfYear the weekOfYear value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..b54cab68f480b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A short term retention policy. */ +@JsonFlatten +@Fluent +public class ManagedBackupShortTermRetentionPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedBackupShortTermRetentionPolicyInner.class); + + /* + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @param retentionDays the retentionDays value to set. + * @return the ManagedBackupShortTermRetentionPolicyInner object itself. + */ + public ManagedBackupShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java new file mode 100644 index 0000000000000..fa502543568da --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A managed database resource. */ +@JsonFlatten +@Fluent +public class ManagedDatabaseInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseInner.class); + + /* + * Collation of the managed database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /* + * Status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /* + * Creation date of the database. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "properties.earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestorePoint; + + /* + * Conditional. If createMode is PointInTimeRestore, this value is + * required. Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Geo paired region. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /* + * Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. + * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be + * specified. RestoreExternalBackup: Create a database by restoring from + * external backup files. Collation, StorageContainerUri and + * StorageContainerSasToken must be specified. Recovery: Creates a database + * by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. + * RestoreLongTermRetentionBackup: Create a database by restoring from a + * long term retention backup (longTermRetentionBackupResourceId required). + */ + @JsonProperty(value = "properties.createMode") + private ManagedDatabaseCreateMode createMode; + + /* + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for + * this restore are stored. + */ + @JsonProperty(value = "properties.storageContainerUri") + private String storageContainerUri; + + /* + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The restorable dropped database resource id to restore when creating + * this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "properties.storageContainerSasToken") + private String storageContainerSasToken; + + /* + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /* + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The name of the Long Term Retention backup to be used for restore of + * this managed database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * Whether to auto complete restore of this managed database. + */ + @JsonProperty(value = "properties.autoCompleteRestore") + private Boolean autoCompleteRestore; + + /* + * Last backup file name for restore of this managed database. + */ + @JsonProperty(value = "properties.lastBackupName") + private String lastBackupName; + + /** + * Get the collation property: Collation of the managed database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: Collation of the managed database. + * + * @param collation the collation value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the status property: Status of the database. + * + * @return the status value. + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + public OffsetDateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the createMode property: Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must + * be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, + * StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a + * geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to + * restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @return the createMode value. + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must + * be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, + * StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a + * geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to + * restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @param createMode the createMode value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the storageContainerUri property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @return the storageContainerUri value. + */ + public String storageContainerUri() { + return this.storageContainerUri; + } + + /** + * Set the storageContainerUri property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @param storageContainerUri the storageContainerUri value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + * + * @return the storageContainerSasToken value. + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + * + * @param storageContainerSasToken the storageContainerSasToken value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get the failoverGroupId property: Instance Failover Group resource identifier that this managed database belongs + * to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value. + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @return the autoCompleteRestore value. + */ + public Boolean autoCompleteRestore() { + return this.autoCompleteRestore; + } + + /** + * Set the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @param autoCompleteRestore the autoCompleteRestore value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withAutoCompleteRestore(Boolean autoCompleteRestore) { + this.autoCompleteRestore = autoCompleteRestore; + return this; + } + + /** + * Get the lastBackupName property: Last backup file name for restore of this managed database. + * + * @return the lastBackupName value. + */ + public String lastBackupName() { + return this.lastBackupName; + } + + /** + * Set the lastBackupName property: Last backup file name for restore of this managed database. + * + * @param lastBackupName the lastBackupName value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withLastBackupName(String lastBackupName) { + this.lastBackupName = lastBackupName; + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedDatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedDatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.java new file mode 100644 index 0000000000000..f7cdf211130d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed database restore details. */ +@JsonFlatten +@Immutable +public class ManagedDatabaseRestoreDetailsResultInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseRestoreDetailsResultInner.class); + + /* + * Restore status. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Current restoring file name. + */ + @JsonProperty(value = "properties.currentRestoringFileName", access = JsonProperty.Access.WRITE_ONLY) + private String currentRestoringFileName; + + /* + * Last restored file name. + */ + @JsonProperty(value = "properties.lastRestoredFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastRestoredFileName; + + /* + * Last restored file time. + */ + @JsonProperty(value = "properties.lastRestoredFileTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastRestoredFileTime; + + /* + * Percent completed. + */ + @JsonProperty(value = "properties.percentCompleted", access = JsonProperty.Access.WRITE_ONLY) + private Double percentCompleted; + + /* + * List of unrestorable files. + */ + @JsonProperty(value = "properties.unrestorableFiles", access = JsonProperty.Access.WRITE_ONLY) + private List unrestorableFiles; + + /* + * Number of files detected. + */ + @JsonProperty(value = "properties.numberOfFilesDetected", access = JsonProperty.Access.WRITE_ONLY) + private Long numberOfFilesDetected; + + /* + * Last uploaded file name. + */ + @JsonProperty(value = "properties.lastUploadedFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastUploadedFileName; + + /* + * Last uploaded file time. + */ + @JsonProperty(value = "properties.lastUploadedFileTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUploadedFileTime; + + /* + * The reason why restore is in Blocked state. + */ + @JsonProperty(value = "properties.blockReason", access = JsonProperty.Access.WRITE_ONLY) + private String blockReason; + + /** + * Get the status property: Restore status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the currentRestoringFileName property: Current restoring file name. + * + * @return the currentRestoringFileName value. + */ + public String currentRestoringFileName() { + return this.currentRestoringFileName; + } + + /** + * Get the lastRestoredFileName property: Last restored file name. + * + * @return the lastRestoredFileName value. + */ + public String lastRestoredFileName() { + return this.lastRestoredFileName; + } + + /** + * Get the lastRestoredFileTime property: Last restored file time. + * + * @return the lastRestoredFileTime value. + */ + public OffsetDateTime lastRestoredFileTime() { + return this.lastRestoredFileTime; + } + + /** + * Get the percentCompleted property: Percent completed. + * + * @return the percentCompleted value. + */ + public Double percentCompleted() { + return this.percentCompleted; + } + + /** + * Get the unrestorableFiles property: List of unrestorable files. + * + * @return the unrestorableFiles value. + */ + public List unrestorableFiles() { + return this.unrestorableFiles; + } + + /** + * Get the numberOfFilesDetected property: Number of files detected. + * + * @return the numberOfFilesDetected value. + */ + public Long numberOfFilesDetected() { + return this.numberOfFilesDetected; + } + + /** + * Get the lastUploadedFileName property: Last uploaded file name. + * + * @return the lastUploadedFileName value. + */ + public String lastUploadedFileName() { + return this.lastUploadedFileName; + } + + /** + * Get the lastUploadedFileTime property: Last uploaded file time. + * + * @return the lastUploadedFileTime value. + */ + public OffsetDateTime lastUploadedFileTime() { + return this.lastUploadedFileTime; + } + + /** + * Get the blockReason property: The reason why restore is in Blocked state. + * + * @return the blockReason value. + */ + public String blockReason() { + return this.blockReason; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..e4c0b0f0a6726 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed database security alert policy. */ +@JsonFlatten +@Fluent +public class ManagedDatabaseSecurityAlertPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseSecurityAlertPolicyInner.class); + + /* + * Specifies the state of the policy, whether it is enabled or disabled or + * a policy has not been applied yet on the specific database. + */ + @JsonProperty(value = "properties.state") + private SecurityAlertPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorInner.java new file mode 100644 index 0000000000000..f0f7ed1424683 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** An Azure SQL managed instance administrator. */ +@JsonFlatten +@Fluent +public class ManagedInstanceAdministratorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceAdministratorInner.class); + + /* + * Type of the managed instance administrator. + */ + @JsonProperty(value = "properties.administratorType") + private ManagedInstanceAdministratorType administratorType; + + /* + * Login name of the managed instance administrator. + */ + @JsonProperty(value = "properties.login") + private String login; + + /* + * SID (object ID) of the managed instance administrator. + */ + @JsonProperty(value = "properties.sid") + private UUID sid; + + /* + * Tenant ID of the managed instance administrator. + */ + @JsonProperty(value = "properties.tenantId") + private UUID tenantId; + + /** + * Get the administratorType property: Type of the managed instance administrator. + * + * @return the administratorType value. + */ + public ManagedInstanceAdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: Type of the managed instance administrator. + * + * @param administratorType the administratorType value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withAdministratorType(ManagedInstanceAdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the login property: Login name of the managed instance administrator. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: Login name of the managed instance administrator. + * + * @param login the login value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: SID (object ID) of the managed instance administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: SID (object ID) of the managed instance administrator. + * + * @param sid the sid value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: Tenant ID of the managed instance administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID of the managed instance administrator. + * + * @param tenantId the tenantId value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.java new file mode 100644 index 0000000000000..843a28ab87000 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Active Directory only authentication. */ +@JsonFlatten +@Fluent +public class ManagedInstanceAzureADOnlyAuthenticationInner extends ProxyResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceAzureADOnlyAuthenticationInner.class); + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "properties.azureADOnlyAuthentication") + private Boolean azureADOnlyAuthentication; + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ManagedInstanceAzureADOnlyAuthenticationInner object itself. + */ + public ManagedInstanceAzureADOnlyAuthenticationInner withAzureADOnlyAuthentication( + Boolean azureADOnlyAuthentication) { + this.azureADOnlyAuthentication = azureADOnlyAuthentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.java new file mode 100644 index 0000000000000..b0de7e33db2e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed instance encryption protector. */ +@JsonFlatten +@Fluent +public class ManagedInstanceEncryptionProtectorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceEncryptionProtectorInner.class); + + /* + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * The name of the managed instance key. + */ + @JsonProperty(value = "properties.serverKeyName") + private String serverKeyName; + + /* + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType") + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * Get the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the serverKeyName property: The name of the managed instance key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the serverKeyName property: The name of the managed instance key. + * + * @param serverKeyName the serverKeyName value to set. + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java new file mode 100644 index 0000000000000..a9e1dce3de1f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java @@ -0,0 +1,749 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePecProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePropertiesProvisioningState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.ManagedServerCreateMode; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.azure.resourcemanager.sql.generated.models.StorageAccountType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An Azure SQL managed instance. */ +@JsonFlatten +@Fluent +public class ManagedInstanceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceInner.class); + + /* + * The Azure Active Directory identity of the managed instance. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, + * BC_Gen4, BC_Gen5 + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The provisioningState property. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstancePropertiesProvisioningState provisioningState; + + /* + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + + /* + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * Administrator username for the managed instance. Can only be specified + * when the managed instance is being created (and is required for + * creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /* + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /* + * The state of the managed instance. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). + */ + @JsonProperty(value = "properties.licenseType") + private ManagedInstanceLicenseType licenseType; + + /* + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /* + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. + */ + @JsonProperty(value = "properties.storageSizeInGB") + private Integer storageSizeInGB; + + /* + * Collation of the managed instance. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /* + * The Dns Zone that the managed instance is in. + */ + @JsonProperty(value = "properties.dnsZone", access = JsonProperty.Access.WRITE_ONLY) + private String dnsZone; + + /* + * The resource id of another managed instance whose DNS zone this managed + * instance will share after creation. + */ + @JsonProperty(value = "properties.dnsZonePartner") + private String dnsZonePartner; + + /* + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /* + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /* + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Connection type used for connecting to the instance. + */ + @JsonProperty(value = "properties.proxyOverride") + private ManagedInstanceProxyOverride proxyOverride; + + /* + * Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in + * registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time + * Zones. + * You can get those registry values via SQL Server by querying SELECT name + * AS timezone_id FROM sys.time_zone_info. + * List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + * An example of valid timezone id is "Pacific Standard Time" or "W. Europe + * Standard Time". + */ + @JsonProperty(value = "properties.timezoneId") + private String timezoneId; + + /* + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + + /* + * Specifies maintenance configuration id to apply to this managed + * instance. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * List of private endpoint connections on a managed instance. + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "properties.minimalTlsVersion") + private String minimalTlsVersion; + + /* + * The storage account type used to store backups for this instance. The + * options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) + * and GRS (GeoRedundantStorage) + */ + @JsonProperty(value = "properties.storageAccountType") + private StorageAccountType storageAccountType; + + /* + * Whether or not the multi-az is enabled. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Get the identity property: The Azure Active Directory identity of the managed instance. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The Azure Active Directory identity of the managed instance. + * + * @param identity the identity value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @param sku the sku value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @return the managedInstanceCreateMode value. + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the administratorLogin property: Administrator username for the managed instance. Can only be specified when + * the managed instance is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator username for the managed instance. Can only be specified when + * the managed instance is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: Subnet resource ID for the managed instance. + * + * @param subnetId the subnetId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state property: The state of the managed instance. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @return the licenseType value. + */ + public ManagedInstanceLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @param licenseType the licenseType value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withLicenseType(ManagedInstanceLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @param vCores the vCores value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @return the storageSizeInGB value. + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @param storageSizeInGB the storageSizeInGB value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Get the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: Collation of the managed instance. + * + * @param collation the collation value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the dnsZone property: The Dns Zone that the managed instance is in. + * + * @return the dnsZone value. + */ + public String dnsZone() { + return this.dnsZone; + } + + /** + * Get the dnsZonePartner property: The resource id of another managed instance whose DNS zone this managed instance + * will share after creation. + * + * @return the dnsZonePartner value. + */ + public String dnsZonePartner() { + return this.dnsZonePartner; + } + + /** + * Set the dnsZonePartner property: The resource id of another managed instance whose DNS zone this managed instance + * will share after creation. + * + * @param dnsZonePartner the dnsZonePartner value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withDnsZonePartner(String dnsZonePartner) { + this.dnsZonePartner = dnsZonePartner; + return this; + } + + /** + * Get the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value. + */ + public Boolean publicDataEndpointEnabled() { + return this.publicDataEndpointEnabled; + } + + /** + * Set the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @param publicDataEndpointEnabled the publicDataEndpointEnabled value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + this.publicDataEndpointEnabled = publicDataEndpointEnabled; + return this; + } + + /** + * Get the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @return the sourceManagedInstanceId value. + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.proxyOverride; + } + + /** + * Set the proxyOverride property: Connection type used for connecting to the instance. + * + * @param proxyOverride the proxyOverride value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + + /** + * Get the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @return the timezoneId value. + */ + public String timezoneId() { + return this.timezoneId; + } + + /** + * Set the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withTimezoneId(String timezoneId) { + this.timezoneId = timezoneId; + return this; + } + + /** + * Get the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value. + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a managed instance. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the storageAccountType property: The storage account type used to store backups for this instance. The + * options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + * + * @return the storageAccountType value. + */ + public StorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: The storage account type used to store backups for this instance. The + * options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + * + * @param storageAccountType the storageAccountType value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withStorageAccountType(StorageAccountType storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedInstanceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedInstanceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.java new file mode 100644 index 0000000000000..cef69f46aa20c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed instance key. */ +@JsonFlatten +@Fluent +public class ManagedInstanceKeyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceKeyInner.class); + + /* + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * The key type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType") + private ServerKeyType serverKeyType; + + /* + * The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI + * is required. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /* + * Thumbprint of the key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The key creation date. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /** + * Get the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ManagedInstanceKeyInner object itself. + */ + public ManagedInstanceKeyInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set. + * @return the ManagedInstanceKeyInner object itself. + */ + public ManagedInstanceKeyInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.java new file mode 100644 index 0000000000000..773902c0e8de2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A long term retention backup for a managed database. */ +@JsonFlatten +@Immutable +public class ManagedInstanceLongTermRetentionBackupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceLongTermRetentionBackupInner.class); + + /* + * The managed instance that the backup database belongs to. + */ + @JsonProperty(value = "properties.managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /* + * The create time of the instance. + */ + @JsonProperty(value = "properties.managedInstanceCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime managedInstanceCreateTime; + + /* + * The name of the database the backup belong to + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The delete time of the database + */ + @JsonProperty(value = "properties.databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime databaseDeletionTime; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "properties.backupTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupTime; + + /* + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "properties.backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupExpirationTime; + + /** + * Get the managedInstanceName property: The managed instance that the backup database belongs to. + * + * @return the managedInstanceName value. + */ + public String managedInstanceName() { + return this.managedInstanceName; + } + + /** + * Get the managedInstanceCreateTime property: The create time of the instance. + * + * @return the managedInstanceCreateTime value. + */ + public OffsetDateTime managedInstanceCreateTime() { + return this.managedInstanceCreateTime; + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.databaseDeletionTime; + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.backupTime; + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.backupExpirationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..7f5d3d3db6def --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionPolicyInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A long term retention policy. */ +@JsonFlatten +@Fluent +public class ManagedInstanceLongTermRetentionPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceLongTermRetentionPolicyInner.class); + + /* + * The weekly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weeklyRetention") + private String weeklyRetention; + + /* + * The monthly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.monthlyRetention") + private String monthlyRetention; + + /* + * The yearly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.yearlyRetention") + private String yearlyRetention; + + /* + * The week of year to take the yearly backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weekOfYear") + private Integer weekOfYear; + + /** + * Get the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + public String weeklyRetention() { + return this.weeklyRetention; + } + + /** + * Set the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @param weeklyRetention the weeklyRetention value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withWeeklyRetention(String weeklyRetention) { + this.weeklyRetention = weeklyRetention; + return this; + } + + /** + * Get the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + public String monthlyRetention() { + return this.monthlyRetention; + } + + /** + * Set the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @param monthlyRetention the monthlyRetention value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withMonthlyRetention(String monthlyRetention) { + this.monthlyRetention = monthlyRetention; + return this; + } + + /** + * Get the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + public String yearlyRetention() { + return this.yearlyRetention; + } + + /** + * Set the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @param yearlyRetention the yearlyRetention value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withYearlyRetention(String yearlyRetention) { + this.yearlyRetention = yearlyRetention; + return this; + } + + /** + * Get the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + public Integer weekOfYear() { + return this.weekOfYear; + } + + /** + * Set the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @param weekOfYear the weekOfYear value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.java new file mode 100644 index 0000000000000..6f35b61d1ff07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationParametersPair; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationSteps; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed instance operation. */ +@JsonFlatten +@Immutable +public class ManagedInstanceOperationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceOperationInner.class); + + /* + * The name of the managed instance the operation is being performed on. + */ + @JsonProperty(value = "properties.managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /* + * The name of operation. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "properties.operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "properties.errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "properties.isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "properties.estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "properties.isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /* + * The operation parameters. + */ + @JsonProperty(value = "properties.operationParameters", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstanceOperationParametersPair operationParameters; + + /* + * The operation steps. + */ + @JsonProperty(value = "properties.operationSteps", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstanceOperationSteps operationSteps; + + /** + * Get the managedInstanceName property: The name of the managed instance the operation is being performed on. + * + * @return the managedInstanceName value. + */ + public String managedInstanceName() { + return this.managedInstanceName; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Get the operationParameters property: The operation parameters. + * + * @return the operationParameters value. + */ + public ManagedInstanceOperationParametersPair operationParameters() { + return this.operationParameters; + } + + /** + * Get the operationSteps property: The operation steps. + * + * @return the operationSteps value. + */ + public ManagedInstanceOperationSteps operationSteps() { + return this.operationSteps; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationParameters() != null) { + operationParameters().validate(); + } + if (operationSteps() != null) { + operationSteps().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..9554207063c4f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed instance vulnerability assessment. */ +@JsonFlatten +@Fluent +public class ManagedInstanceVulnerabilityAssessmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceVulnerabilityAssessmentInner.class); + + /* + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath") + private String storageContainerPath; + + /* + * A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + * required. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /* + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value. + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recurringScans() != null) { + recurringScans().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..8f05f103c3b84 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed server security alert policy. */ +@JsonFlatten +@Fluent +public class ManagedServerSecurityAlertPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedServerSecurityAlertPolicyInner.class); + + /* + * Specifies the state of the policy, whether it is enabled or disabled or + * a policy has not been applied yet on the specific database. + */ + @JsonProperty(value = "properties.state") + private SecurityAlertPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.java new file mode 100644 index 0000000000000..4229ea56250f4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.MetricAvailability; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.sql.generated.models.UnitDefinitionType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A database metric definition. */ +@Immutable +public final class MetricDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionInner.class); + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The primary aggregation type defining how metric values are displayed. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /* + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitDefinitionType unit; + + /* + * The list of database metric availabilities for the metric. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the primaryAggregationType property: The primary aggregation type defining how metric values are displayed. + * + * @return the primaryAggregationType value. + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitDefinitionType unit() { + return this.unit; + } + + /** + * Get the metricAvailabilities property: The list of database metric availabilities for the metric. + * + * @return the metricAvailabilities value. + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricAvailabilities() != null) { + metricAvailabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java new file mode 100644 index 0000000000000..20aff091fbf9c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.MetricValue; +import com.azure.resourcemanager.sql.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Database metrics. */ +@Immutable +public final class MetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricInner.class); + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The time step to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain property: The time step to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..d648090be12b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.OperationDisplay; +import com.azure.resourcemanager.sql.generated.models.OperationOrigin; +import com.fasterxml.jackson.annotation.JsonIgnore; +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) + 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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..57a9d724c6f1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProvisioningState; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointProvisioningState provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..e39704d94ddf5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link resource. */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkResourceProperties properties; + + /** + * Get the properties property: The private link resource group id. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedElasticPoolInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedElasticPoolInner.java new file mode 100644 index 0000000000000..f0f0a83de6b3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedElasticPoolInner.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolEdition; +import com.azure.resourcemanager.sql.generated.models.TrackedResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Represents a recommended elastic pool. */ +@JsonFlatten +@Fluent +public class RecommendedElasticPoolInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendedElasticPoolInner.class); + + /* + * The edition of the recommended elastic pool. The ElasticPoolEdition + * enumeration contains all the valid editions. + */ + @JsonProperty(value = "properties.databaseEdition", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolEdition databaseEdition; + + /* + * The DTU for the recommended elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Double dtu; + + /* + * The minimum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Double databaseDtuMin; + + /* + * The maximum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Double databaseDtuMax; + + /* + * Gets storage size in megabytes. + */ + @JsonProperty(value = "properties.storageMB") + private Double storageMB; + + /* + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime observationPeriodStart; + + /* + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime observationPeriodEnd; + + /* + * Gets maximum observed DTU. + */ + @JsonProperty(value = "properties.maxObservedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedDtu; + + /* + * Gets maximum observed storage in megabytes. + */ + @JsonProperty(value = "properties.maxObservedStorageMB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedStorageMB; + + /* + * The list of databases in this pool. Expanded property + */ + @JsonProperty(value = "properties.databases", access = JsonProperty.Access.WRITE_ONLY) + private List databases; + + /* + * The list of databases housed in the server. Expanded property + */ + @JsonProperty(value = "properties.metrics", access = JsonProperty.Access.WRITE_ONLY) + private List metrics; + + /** + * Get the databaseEdition property: The edition of the recommended elastic pool. The ElasticPoolEdition enumeration + * contains all the valid editions. + * + * @return the databaseEdition value. + */ + public ElasticPoolEdition databaseEdition() { + return this.databaseEdition; + } + + /** + * Get the dtu property: The DTU for the recommended elastic pool. + * + * @return the dtu value. + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set the dtu property: The DTU for the recommended elastic pool. + * + * @param dtu the dtu value to set. + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the databaseDtuMin property: The minimum DTU for the database. + * + * @return the databaseDtuMin value. + */ + public Double databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the databaseDtuMin property: The minimum DTU for the database. + * + * @param databaseDtuMin the databaseDtuMin value to set. + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMin(Double databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get the databaseDtuMax property: The maximum DTU for the database. + * + * @return the databaseDtuMax value. + */ + public Double databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the databaseDtuMax property: The maximum DTU for the database. + * + * @param databaseDtuMax the databaseDtuMax value to set. + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMax(Double databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get the storageMB property: Gets storage size in megabytes. + * + * @return the storageMB value. + */ + public Double storageMB() { + return this.storageMB; + } + + /** + * Set the storageMB property: Gets storage size in megabytes. + * + * @param storageMB the storageMB value to set. + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withStorageMB(Double storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get the observationPeriodStart property: The observation period start (ISO8601 format). + * + * @return the observationPeriodStart value. + */ + public OffsetDateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observationPeriodEnd property: The observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value. + */ + public OffsetDateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get the maxObservedDtu property: Gets maximum observed DTU. + * + * @return the maxObservedDtu value. + */ + public Double maxObservedDtu() { + return this.maxObservedDtu; + } + + /** + * Get the maxObservedStorageMB property: Gets maximum observed storage in megabytes. + * + * @return the maxObservedStorageMB value. + */ + public Double maxObservedStorageMB() { + return this.maxObservedStorageMB; + } + + /** + * Get the databases property: The list of databases in this pool. Expanded property. + * + * @return the databases value. + */ + public List databases() { + return this.databases; + } + + /** + * Get the metrics property: The list of databases housed in the server. Expanded property. + * + * @return the metrics value. + */ + public List metrics() { + return this.metrics; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databases() != null) { + databases().forEach(e -> e.validate()); + } + if (metrics() != null) { + metrics().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedElasticPoolMetricInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedElasticPoolMetricInner.java new file mode 100644 index 0000000000000..023742969645b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedElasticPoolMetricInner.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.time.OffsetDateTime; + +/** Represents recommended elastic pool metric. */ +@Fluent +public final class RecommendedElasticPoolMetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendedElasticPoolMetricInner.class); + + /* + * The time of metric (ISO8601 format). + */ + @JsonProperty(value = "dateTime") + private OffsetDateTime dateTime; + + /* + * Gets or sets the DTUs (Database Transaction Units). See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ + */ + @JsonProperty(value = "dtu") + private Double dtu; + + /* + * Gets or sets size in gigabytes. + */ + @JsonProperty(value = "sizeGB") + private Double sizeGB; + + /** + * Get the dateTime property: The time of metric (ISO8601 format). + * + * @return the dateTime value. + */ + public OffsetDateTime dateTime() { + return this.dateTime; + } + + /** + * Set the dateTime property: The time of metric (ISO8601 format). + * + * @param dateTime the dateTime value to set. + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get the dtu property: Gets or sets the DTUs (Database Transaction Units). See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @return the dtu value. + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set the dtu property: Gets or sets the DTUs (Database Transaction Units). See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @param dtu the dtu value to set. + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the sizeGB property: Gets or sets size in gigabytes. + * + * @return the sizeGB value. + */ + public Double sizeGB() { + return this.sizeGB; + } + + /** + * Set the sizeGB property: Gets or sets size in gigabytes. + * + * @param sizeGB the sizeGB value to set. + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withSizeGB(Double sizeGB) { + this.sizeGB = sizeGB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.java new file mode 100644 index 0000000000000..4ea6fdc0873ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A recoverable database. */ +@JsonFlatten +@Immutable +public class RecoverableDatabaseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableDatabaseInner.class); + + /* + * The edition of the database + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /* + * The service level objective name of the database + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /* + * The elastic pool name of the database + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The last available backup date of the database (ISO8601 format) + */ + @JsonProperty(value = "properties.lastAvailableBackupDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastAvailableBackupDate; + + /** + * Get the edition property: The edition of the database. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Get the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the lastAvailableBackupDate property: The last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value. + */ + public OffsetDateTime lastAvailableBackupDate() { + return this.lastAvailableBackupDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java new file mode 100644 index 0000000000000..d6a2943cf75ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable managed database resource. */ +@JsonFlatten +@Immutable +public class RecoverableManagedDatabaseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableManagedDatabaseInner.class); + + /* + * The last available backup date. + */ + @JsonProperty(value = "properties.lastAvailableBackupDate", access = JsonProperty.Access.WRITE_ONLY) + private String lastAvailableBackupDate; + + /** + * Get the lastAvailableBackupDate property: The last available backup date. + * + * @return the lastAvailableBackupDate value. + */ + public String lastAvailableBackupDate() { + return this.lastAvailableBackupDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.java new file mode 100644 index 0000000000000..a5d5573102e33 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ReplicationState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a database replication link. */ +@JsonFlatten +@Immutable +public class ReplicationLinkInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReplicationLinkInner.class); + + /* + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Legacy value indicating whether termination is allowed. Currently + * always returns true. + */ + @JsonProperty(value = "properties.isTerminationAllowed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTerminationAllowed; + + /* + * Replication mode of this replication link. + */ + @JsonProperty(value = "properties.replicationMode", access = JsonProperty.Access.WRITE_ONLY) + private String replicationMode; + + /* + * The name of the server hosting the partner database. + */ + @JsonProperty(value = "properties.partnerServer", access = JsonProperty.Access.WRITE_ONLY) + private String partnerServer; + + /* + * The name of the partner database. + */ + @JsonProperty(value = "properties.partnerDatabase", access = JsonProperty.Access.WRITE_ONLY) + private String partnerDatabase; + + /* + * The Azure Region of the partner database. + */ + @JsonProperty(value = "properties.partnerLocation", access = JsonProperty.Access.WRITE_ONLY) + private String partnerLocation; + + /* + * The role of the database in the replication link. + */ + @JsonProperty(value = "properties.role", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole role; + + /* + * The role of the partner database in the replication link. + */ + @JsonProperty(value = "properties.partnerRole", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole partnerRole; + + /* + * The start time for the replication link. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The percentage of seeding complete for the replication link. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The replication state for the replication link. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationState replicationState; + + /** + * Get the location property: Location of the server that contains this firewall rule. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the isTerminationAllowed property: Legacy value indicating whether termination is allowed. Currently always + * returns true. + * + * @return the isTerminationAllowed value. + */ + public Boolean isTerminationAllowed() { + return this.isTerminationAllowed; + } + + /** + * Get the replicationMode property: Replication mode of this replication link. + * + * @return the replicationMode value. + */ + public String replicationMode() { + return this.replicationMode; + } + + /** + * Get the partnerServer property: The name of the server hosting the partner database. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Get the partnerDatabase property: The name of the partner database. + * + * @return the partnerDatabase value. + */ + public String partnerDatabase() { + return this.partnerDatabase; + } + + /** + * Get the partnerLocation property: The Azure Region of the partner database. + * + * @return the partnerLocation value. + */ + public String partnerLocation() { + return this.partnerLocation; + } + + /** + * Get the role property: The role of the database in the replication link. + * + * @return the role value. + */ + public ReplicationRole role() { + return this.role; + } + + /** + * Get the partnerRole property: The role of the partner database in the replication link. + * + * @return the partnerRole value. + */ + public ReplicationRole partnerRole() { + return this.partnerRole; + } + + /** + * Get the startTime property: The start time for the replication link. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the percentComplete property: The percentage of seeding complete for the replication link. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the replicationState property: The replication state for the replication link. + * + * @return the replicationState value. + */ + public ReplicationState replicationState() { + return this.replicationState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.java new file mode 100644 index 0000000000000..cc2a34535aa13 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A restorable dropped database. */ +@JsonFlatten +@Immutable +public class RestorableDroppedDatabaseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDroppedDatabaseInner.class); + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The name of the database + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The edition of the database + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /* + * The max size in bytes of the database + */ + @JsonProperty(value = "properties.maxSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private String maxSizeBytes; + + /* + * The service level objective name of the database + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /* + * The elastic pool name of the database + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The creation date of the database (ISO8601 format) + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The deletion date of the database (ISO8601 format) + */ + @JsonProperty(value = "properties.deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionDate; + + /* + * The earliest restore date of the database (ISO8601 format) + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the edition property: The edition of the database. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Get the maxSizeBytes property: The max size in bytes of the database. + * + * @return the maxSizeBytes value. + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Get the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.java new file mode 100644 index 0000000000000..9107750330332 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A restorable dropped managed database resource. */ +@JsonFlatten +@Immutable +public class RestorableDroppedManagedDatabaseInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDroppedManagedDatabaseInner.class); + + /* + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionDate; + + /* + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** {@inheritDoc} */ + @Override + public RestorableDroppedManagedDatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableDroppedManagedDatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.java new file mode 100644 index 0000000000000..34d84d6abb272 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.RestorePointType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Database restore points. */ +@JsonFlatten +@Immutable +public class RestorePointInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointInner.class); + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The type of restore point + */ + @JsonProperty(value = "properties.restorePointType", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointType restorePointType; + + /* + * The earliest time to which this database can be restored + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "properties.restorePointCreationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime restorePointCreationDate; + + /* + * The label of restore point for backup request by user + */ + @JsonProperty(value = "properties.restorePointLabel", access = JsonProperty.Access.WRITE_ONLY) + private String restorePointLabel; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the restorePointType property: The type of restore point. + * + * @return the restorePointType value. + */ + public RestorePointType restorePointType() { + return this.restorePointType; + } + + /** + * Get the earliestRestoreDate property: The earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the restorePointCreationDate property: The time the backup was taken. + * + * @return the restorePointCreationDate value. + */ + public OffsetDateTime restorePointCreationDate() { + return this.restorePointCreationDate; + } + + /** + * Get the restorePointLabel property: The label of restore point for backup request by user. + * + * @return the restorePointLabel value. + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.java new file mode 100644 index 0000000000000..1d488744f3b6d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A sensitivity label. */ +@JsonFlatten +@Fluent +public class SensitivityLabelInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SensitivityLabelInner.class); + + /* + * The label name. + */ + @JsonProperty(value = "properties.labelName") + private String labelName; + + /* + * The label ID. + */ + @JsonProperty(value = "properties.labelId") + private String labelId; + + /* + * The information type. + */ + @JsonProperty(value = "properties.informationType") + private String informationType; + + /* + * The information type ID. + */ + @JsonProperty(value = "properties.informationTypeId") + private String informationTypeId; + + /* + * Is sensitivity recommendation disabled. Applicable for recommended + * sensitivity label only. Specifies whether the sensitivity recommendation + * on this column is disabled (dismissed) or not. + */ + @JsonProperty(value = "properties.isDisabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDisabled; + + /* + * The rank property. + */ + @JsonProperty(value = "properties.rank") + private SensitivityLabelRank rank; + + /** + * Get the labelName property: The label name. + * + * @return the labelName value. + */ + public String labelName() { + return this.labelName; + } + + /** + * Set the labelName property: The label name. + * + * @param labelName the labelName value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelName(String labelName) { + this.labelName = labelName; + return this; + } + + /** + * Get the labelId property: The label ID. + * + * @return the labelId value. + */ + public String labelId() { + return this.labelId; + } + + /** + * Set the labelId property: The label ID. + * + * @param labelId the labelId value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelId(String labelId) { + this.labelId = labelId; + return this; + } + + /** + * Get the informationType property: The information type. + * + * @return the informationType value. + */ + public String informationType() { + return this.informationType; + } + + /** + * Set the informationType property: The information type. + * + * @param informationType the informationType value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationType(String informationType) { + this.informationType = informationType; + return this; + } + + /** + * Get the informationTypeId property: The information type ID. + * + * @return the informationTypeId value. + */ + public String informationTypeId() { + return this.informationTypeId; + } + + /** + * Set the informationTypeId property: The information type ID. + * + * @param informationTypeId the informationTypeId value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationTypeId(String informationTypeId) { + this.informationTypeId = informationTypeId; + return this; + } + + /** + * Get the isDisabled property: Is sensitivity recommendation disabled. Applicable for recommended sensitivity label + * only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. + * + * @return the isDisabled value. + */ + public Boolean isDisabled() { + return this.isDisabled; + } + + /** + * Get the rank property: The rank property. + * + * @return the rank value. + */ + public SensitivityLabelRank rank() { + return this.rank; + } + + /** + * Set the rank property: The rank property. + * + * @param rank the rank value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withRank(SensitivityLabelRank rank) { + this.rank = rank; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.java new file mode 100644 index 0000000000000..d8f7acecfe81d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Server-level Automatic Tuning. */ +@JsonFlatten +@Fluent +public class ServerAutomaticTuningInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAutomaticTuningInner.class); + + /* + * Automatic tuning desired state. + */ + @JsonProperty(value = "properties.desiredState") + private AutomaticTuningServerMode desiredState; + + /* + * Automatic tuning actual state. + */ + @JsonProperty(value = "properties.actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerMode actualState; + + /* + * Automatic tuning options definition. + */ + @JsonProperty(value = "properties.options") + private Map options; + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningServerMode desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning desired state. + * + * @param desiredState the desiredState value to set. + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withDesiredState(AutomaticTuningServerMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningServerMode actualState() { + return this.actualState; + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.options; + } + + /** + * Set the options property: Automatic tuning options definition. + * + * @param options the options value to set. + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withOptions(Map options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (options() != null) { + options() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.java new file mode 100644 index 0000000000000..86a95ec233fea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory administrator. */ +@JsonFlatten +@Fluent +public class ServerAzureADAdministratorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAzureADAdministratorInner.class); + + /* + * Type of the sever administrator. + */ + @JsonProperty(value = "properties.administratorType") + private AdministratorType administratorType; + + /* + * Login name of the server administrator. + */ + @JsonProperty(value = "properties.login") + private String login; + + /* + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "properties.sid") + private UUID sid; + + /* + * Tenant ID of the administrator. + */ + @JsonProperty(value = "properties.tenantId") + private UUID tenantId; + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "properties.azureADOnlyAuthentication", access = JsonProperty.Access.WRITE_ONLY) + private Boolean azureADOnlyAuthentication; + + /** + * Get the administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: Type of the sever administrator. + * + * @param administratorType the administratorType value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the login property: Login name of the server administrator. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: Login name of the server administrator. + * + * @param login the login value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: SID (object ID) of the server administrator. + * + * @param sid the sid value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID of the administrator. + * + * @param tenantId the tenantId value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.java new file mode 100644 index 0000000000000..546d74a33047c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Active Directory only authentication. */ +@JsonFlatten +@Fluent +public class ServerAzureADOnlyAuthenticationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAzureADOnlyAuthenticationInner.class); + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "properties.azureADOnlyAuthentication") + private Boolean azureADOnlyAuthentication; + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ServerAzureADOnlyAuthenticationInner object itself. + */ + public ServerAzureADOnlyAuthenticationInner withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication) { + this.azureADOnlyAuthentication = azureADOnlyAuthentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..0376a86a34be8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.java @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** A server blob auditing policy. */ +@JsonFlatten +@Fluent +public class ServerBlobAuditingPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerBlobAuditingPolicyInner.class); + + /* + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "properties.state") + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the + * storageAccountAccessKey will use SQL server system-assigned managed + * identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding + * 'Storage Blob Data Contributor' RBAC role to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that in the above format can refer to an object like a + * table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /* + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'state' as + * 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + * + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647. + */ + @JsonProperty(value = "properties.queueDelayMs") + private Integer queueDelayMs; + + /** + * Get the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.java new file mode 100644 index 0000000000000..3d3541a08cd57 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server communication link. */ +@JsonFlatten +@Fluent +public class ServerCommunicationLinkInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerCommunicationLinkInner.class); + + /* + * Communication link location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Communication link kind. This property is used for Azure Portal + * metadata. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * The state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The name of the partner server. + */ + @JsonProperty(value = "properties.partnerServer") + private String partnerServer; + + /** + * Get the location property: Communication link location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: Communication link kind. This property is used for Azure Portal metadata. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the state property: The state. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the partnerServer property: The name of the partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Set the partnerServer property: The name of the partner server. + * + * @param partnerServer the partnerServer value to set. + * @return the ServerCommunicationLinkInner object itself. + */ + public ServerCommunicationLinkInner withPartnerServer(String partnerServer) { + this.partnerServer = partnerServer; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.java new file mode 100644 index 0000000000000..8c2a21e06497f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server secure connection policy. */ +@JsonFlatten +@Fluent +public class ServerConnectionPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerConnectionPolicyInner.class); + + /* + * Metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The server connection type. + */ + @JsonProperty(value = "properties.connectionType") + private ServerConnectionType connectionType; + + /** + * Get the kind property: Metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the connectionType property: The server connection type. + * + * @return the connectionType value. + */ + public ServerConnectionType connectionType() { + return this.connectionType; + } + + /** + * Set the connectionType property: The server connection type. + * + * @param connectionType the connectionType value to set. + * @return the ServerConnectionPolicyInner object itself. + */ + public ServerConnectionPolicyInner withConnectionType(ServerConnectionType connectionType) { + this.connectionType = connectionType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.java new file mode 100644 index 0000000000000..81c0e921f5e73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** A server DevOps auditing settings. */ +@JsonFlatten +@Fluent +public class ServerDevOpsAuditingSettingsInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerDevOpsAuditingSettingsInner.class); + + /* + * SystemData of ServerDevOpsAuditSettingsResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Specifies whether DevOps audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure DevOps audit, Diagnostic Settings with + * 'DevOpsOperationsAudit' diagnostic logs category on the master database + * should be also created. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + * + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "properties.state") + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the + * storageAccountAccessKey will use SQL server system-assigned managed + * identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding + * 'Storage Blob Data Contributor' RBAC role to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Get the systemData property: SystemData of ServerDevOpsAuditSettingsResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the isAzureMonitorTargetEnabled property: Specifies whether DevOps audit events are sent to Azure Monitor. In + * order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as + * true. + * + *

When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set the isAzureMonitorTargetEnabled property: Specifies whether DevOps audit events are sent to Azure Monitor. In + * order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as + * true. + * + *

When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java new file mode 100644 index 0000000000000..3a24467d89b9e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server DNS alias. */ +@JsonFlatten +@Immutable +public class ServerDnsAliasInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerDnsAliasInner.class); + + /* + * The fully qualified DNS record for alias + */ + @JsonProperty(value = "properties.azureDnsRecord", access = JsonProperty.Access.WRITE_ONLY) + private String azureDnsRecord; + + /** + * Get the azureDnsRecord property: The fully qualified DNS record for alias. + * + * @return the azureDnsRecord value. + */ + public String azureDnsRecord() { + return this.azureDnsRecord; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java new file mode 100644 index 0000000000000..b3d9a928256cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerPublicNetworkAccess; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure SQL Database server. */ +@JsonFlatten +@Fluent +public class ServerInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerInner.class); + + /* + * The Azure Active Directory identity of the server. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Kind of sql server. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The version of the server. + */ + @JsonProperty(value = "properties.version") + private String version; + + /* + * The state of the server. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * List of private endpoint connections on a server + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "properties.minimalTlsVersion") + private String minimalTlsVersion; + + /* + * Whether or not public endpoint access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private ServerPublicNetworkAccess publicNetworkAccess; + + /** + * Get the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The Azure Active Directory identity of the server. + * + * @param identity the identity value to set. + * @return the ServerInner object itself. + */ + public ServerInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the kind property: Kind of sql server. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version property: The version of the server. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the server. + * + * @param version the version value to set. + * @return the ServerInner object itself. + */ + public ServerInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state property: The state of the server. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerInner object itself. + */ + public ServerInner withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public ServerPublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerInner object itself. + */ + public ServerInner withPublicNetworkAccess(ServerPublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.java new file mode 100644 index 0000000000000..01f75328cf56f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A server key. */ +@JsonFlatten +@Fluent +public class ServerKeyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerKeyInner.class); + + /* + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Subregion of the server key. + */ + @JsonProperty(value = "properties.subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /* + * The server key type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType") + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint") + private String thumbprint; + + /* + * The server key creation date. + */ + @JsonProperty(value = "properties.creationDate") + private OffsetDateTime creationDate; + + /** + * Get the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @param kind the kind value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the subregion property: Subregion of the server key. + * + * @return the subregion value. + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the server key. + * + * @param uri the uri value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: Thumbprint of the server key. + * + * @param thumbprint the thumbprint value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the creationDate property: The server key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Set the creationDate property: The server key creation date. + * + * @param creationDate the creationDate value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withCreationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..a6752eac45b95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A server security alert policy. */ +@JsonFlatten +@Fluent +public class ServerSecurityAlertPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPolicyInner.class); + + /* + * Specifies the state of the policy, whether it is enabled or disabled or + * a policy has not been applied yet on the specific database. + */ + @JsonProperty(value = "properties.state") + private SecurityAlertPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.java new file mode 100644 index 0000000000000..cd9070152ff18 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A server trust group. */ +@JsonFlatten +@Fluent +public class ServerTrustGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerTrustGroupInner.class); + + /* + * Group members information for the server trust group. + */ + @JsonProperty(value = "properties.groupMembers") + private List groupMembers; + + /* + * Trust scope of the server trust group. + */ + @JsonProperty(value = "properties.trustScopes") + private List trustScopes; + + /** + * Get the groupMembers property: Group members information for the server trust group. + * + * @return the groupMembers value. + */ + public List groupMembers() { + return this.groupMembers; + } + + /** + * Set the groupMembers property: Group members information for the server trust group. + * + * @param groupMembers the groupMembers value to set. + * @return the ServerTrustGroupInner object itself. + */ + public ServerTrustGroupInner withGroupMembers(List groupMembers) { + this.groupMembers = groupMembers; + return this; + } + + /** + * Get the trustScopes property: Trust scope of the server trust group. + * + * @return the trustScopes value. + */ + public List trustScopes() { + return this.trustScopes; + } + + /** + * Set the trustScopes property: Trust scope of the server trust group. + * + * @param trustScopes the trustScopes value to set. + * @return the ServerTrustGroupInner object itself. + */ + public ServerTrustGroupInner withTrustScopes(List trustScopes) { + this.trustScopes = trustScopes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (groupMembers() != null) { + groupMembers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.java new file mode 100644 index 0000000000000..8a9d485c81f10 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents server metrics. */ +@Immutable +public final class ServerUsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerUsageInner.class); + + /* + * Name of the server usage metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The name of the resource. + */ + @JsonProperty(value = "resourceName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceName; + + /* + * The metric display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The current value of the metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * The current limit of the metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * The units of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * The next reset time for the metric (ISO8601 format). + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime nextResetTime; + + /** + * Get the name property: Name of the server usage metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the resourceName property: The name of the resource. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the displayName property: The metric display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the currentValue property: The current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: The current limit of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: The units of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the nextResetTime property: The next reset time for the metric (ISO8601 format). + * + * @return the nextResetTime value. + */ + public OffsetDateTime nextResetTime() { + return this.nextResetTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..f0b9649fb9330 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server vulnerability assessment. */ +@JsonFlatten +@Fluent +public class ServerVulnerabilityAssessmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentInner.class); + + /* + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath") + private String storageContainerPath; + + /* + * A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + * required. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /* + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value. + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recurringScans() != null) { + recurringScans().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.java new file mode 100644 index 0000000000000..34e2fd069d25e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database service objective. */ +@JsonFlatten +@Immutable +public class ServiceObjectiveInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceObjectiveInner.class); + + /* + * The name for the service objective. + */ + @JsonProperty(value = "properties.serviceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceObjectiveName; + + /* + * Gets whether the service level objective is the default service + * objective. + */ + @JsonProperty(value = "properties.isDefault", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDefault; + + /* + * Gets whether the service level objective is a system service objective. + */ + @JsonProperty(value = "properties.isSystem", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isSystem; + + /* + * The description for the service level objective. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Gets whether the service level objective is enabled. + */ + @JsonProperty(value = "properties.enabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean enabled; + + /** + * Get the serviceObjectiveName property: The name for the service objective. + * + * @return the serviceObjectiveName value. + */ + public String serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Get the isDefault property: Gets whether the service level objective is the default service objective. + * + * @return the isDefault value. + */ + public Boolean isDefault() { + return this.isDefault; + } + + /** + * Get the isSystem property: Gets whether the service level objective is a system service objective. + * + * @return the isSystem value. + */ + public Boolean isSystem() { + return this.isSystem; + } + + /** + * Get the description property: The description for the service level objective. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the enabled property: Gets whether the service level objective is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceTierAdvisorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceTierAdvisorInner.java new file mode 100644 index 0000000000000..e2d117678b5ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceTierAdvisorInner.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SloUsageMetric; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +/** Represents a Service Tier Advisor. */ +@JsonFlatten +@Immutable +public class ServiceTierAdvisorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceTierAdvisorInner.class); + + /* + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime observationPeriodStart; + + /* + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime observationPeriodEnd; + + /* + * The activeTimeRatio for service tier advisor. + */ + @JsonProperty(value = "properties.activeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private Double activeTimeRatio; + + /* + * Gets or sets minDtu for service tier advisor. + */ + @JsonProperty(value = "properties.minDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double minDtu; + + /* + * Gets or sets avgDtu for service tier advisor. + */ + @JsonProperty(value = "properties.avgDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double avgDtu; + + /* + * Gets or sets maxDtu for service tier advisor. + */ + @JsonProperty(value = "properties.maxDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxDtu; + + /* + * Gets or sets maxSizeInGB for service tier advisor. + */ + @JsonProperty(value = "properties.maxSizeInGB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxSizeInGB; + + /* + * Gets or sets serviceLevelObjectiveUsageMetrics for the service tier + * advisor. + */ + @JsonProperty(value = "properties.serviceLevelObjectiveUsageMetrics", access = JsonProperty.Access.WRITE_ONLY) + private List serviceLevelObjectiveUsageMetrics; + + /* + * Gets or sets currentServiceLevelObjective for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceLevelObjective; + + /* + * Gets or sets currentServiceLevelObjectiveId for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceLevelObjectiveId; + + /* + * Gets or sets usageBasedRecommendationServiceLevelObjective for service + * tier advisor. + */ + @JsonProperty( + value = "properties.usageBasedRecommendationServiceLevelObjective", + access = JsonProperty.Access.WRITE_ONLY) + private String usageBasedRecommendationServiceLevelObjective; + + /* + * Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty( + value = "properties.usageBasedRecommendationServiceLevelObjectiveId", + access = JsonProperty.Access.WRITE_ONLY) + private UUID usageBasedRecommendationServiceLevelObjectiveId; + + /* + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty( + value = "properties.databaseSizeBasedRecommendationServiceLevelObjective", + access = JsonProperty.Access.WRITE_ONLY) + private String databaseSizeBasedRecommendationServiceLevelObjective; + + /* + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty( + value = "properties.databaseSizeBasedRecommendationServiceLevelObjectiveId", + access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseSizeBasedRecommendationServiceLevelObjectiveId; + + /* + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty( + value = "properties.disasterPlanBasedRecommendationServiceLevelObjective", + access = JsonProperty.Access.WRITE_ONLY) + private String disasterPlanBasedRecommendationServiceLevelObjective; + + /* + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty( + value = "properties.disasterPlanBasedRecommendationServiceLevelObjectiveId", + access = JsonProperty.Access.WRITE_ONLY) + private UUID disasterPlanBasedRecommendationServiceLevelObjectiveId; + + /* + * Gets or sets overallRecommendationServiceLevelObjective for service tier + * advisor. + */ + @JsonProperty( + value = "properties.overallRecommendationServiceLevelObjective", + access = JsonProperty.Access.WRITE_ONLY) + private String overallRecommendationServiceLevelObjective; + + /* + * Gets or sets overallRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty( + value = "properties.overallRecommendationServiceLevelObjectiveId", + access = JsonProperty.Access.WRITE_ONLY) + private UUID overallRecommendationServiceLevelObjectiveId; + + /* + * Gets or sets confidence for service tier advisor. + */ + @JsonProperty(value = "properties.confidence", access = JsonProperty.Access.WRITE_ONLY) + private Double confidence; + + /** + * Get the observationPeriodStart property: The observation period start (ISO8601 format). + * + * @return the observationPeriodStart value. + */ + public OffsetDateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observationPeriodEnd property: The observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value. + */ + public OffsetDateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get the activeTimeRatio property: The activeTimeRatio for service tier advisor. + * + * @return the activeTimeRatio value. + */ + public Double activeTimeRatio() { + return this.activeTimeRatio; + } + + /** + * Get the minDtu property: Gets or sets minDtu for service tier advisor. + * + * @return the minDtu value. + */ + public Double minDtu() { + return this.minDtu; + } + + /** + * Get the avgDtu property: Gets or sets avgDtu for service tier advisor. + * + * @return the avgDtu value. + */ + public Double avgDtu() { + return this.avgDtu; + } + + /** + * Get the maxDtu property: Gets or sets maxDtu for service tier advisor. + * + * @return the maxDtu value. + */ + public Double maxDtu() { + return this.maxDtu; + } + + /** + * Get the maxSizeInGB property: Gets or sets maxSizeInGB for service tier advisor. + * + * @return the maxSizeInGB value. + */ + public Double maxSizeInGB() { + return this.maxSizeInGB; + } + + /** + * Get the serviceLevelObjectiveUsageMetrics property: Gets or sets serviceLevelObjectiveUsageMetrics for the + * service tier advisor. + * + * @return the serviceLevelObjectiveUsageMetrics value. + */ + public List serviceLevelObjectiveUsageMetrics() { + return this.serviceLevelObjectiveUsageMetrics; + } + + /** + * Get the currentServiceLevelObjective property: Gets or sets currentServiceLevelObjective for service tier + * advisor. + * + * @return the currentServiceLevelObjective value. + */ + public String currentServiceLevelObjective() { + return this.currentServiceLevelObjective; + } + + /** + * Get the currentServiceLevelObjectiveId property: Gets or sets currentServiceLevelObjectiveId for service tier + * advisor. + * + * @return the currentServiceLevelObjectiveId value. + */ + public UUID currentServiceLevelObjectiveId() { + return this.currentServiceLevelObjectiveId; + } + + /** + * Get the usageBasedRecommendationServiceLevelObjective property: Gets or sets + * usageBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjective value. + */ + public String usageBasedRecommendationServiceLevelObjective() { + return this.usageBasedRecommendationServiceLevelObjective; + } + + /** + * Get the usageBasedRecommendationServiceLevelObjectiveId property: Gets or sets + * usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjectiveId value. + */ + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.usageBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get the databaseSizeBasedRecommendationServiceLevelObjective property: Gets or sets + * databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjective value. + */ + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.databaseSizeBasedRecommendationServiceLevelObjective; + } + + /** + * Get the databaseSizeBasedRecommendationServiceLevelObjectiveId property: Gets or sets + * databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value. + */ + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.databaseSizeBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get the disasterPlanBasedRecommendationServiceLevelObjective property: Gets or sets + * disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjective value. + */ + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.disasterPlanBasedRecommendationServiceLevelObjective; + } + + /** + * Get the disasterPlanBasedRecommendationServiceLevelObjectiveId property: Gets or sets + * disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value. + */ + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.disasterPlanBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get the overallRecommendationServiceLevelObjective property: Gets or sets + * overallRecommendationServiceLevelObjective for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjective value. + */ + public String overallRecommendationServiceLevelObjective() { + return this.overallRecommendationServiceLevelObjective; + } + + /** + * Get the overallRecommendationServiceLevelObjectiveId property: Gets or sets + * overallRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjectiveId value. + */ + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.overallRecommendationServiceLevelObjectiveId; + } + + /** + * Get the confidence property: Gets or sets confidence for service tier advisor. + * + * @return the confidence value. + */ + public Double confidence() { + return this.confidence; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceLevelObjectiveUsageMetrics() != null) { + serviceLevelObjectiveUsageMetrics().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.java new file mode 100644 index 0000000000000..0db4357e9ec03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Usage Metric of a Subscription in a Location. */ +@JsonFlatten +@Immutable +public class SubscriptionUsageInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubscriptionUsageInner.class); + + /* + * User-readable name of the metric. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Current value of the metric. + */ + @JsonProperty(value = "properties.currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * Boundary value of the metric. + */ + @JsonProperty(value = "properties.limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Unit of the metric. + */ + @JsonProperty(value = "properties.unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Get the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: Unit of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.java new file mode 100644 index 0000000000000..ed17ff5be2a3d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SyncAgentState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An Azure SQL Database sync agent. */ +@JsonFlatten +@Fluent +public class SyncAgentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncAgentInner.class); + + /* + * Name of the sync agent. + */ + @JsonProperty(value = "properties.name", access = JsonProperty.Access.WRITE_ONLY) + private String namePropertiesName; + + /* + * ARM resource id of the sync database in the sync agent. + */ + @JsonProperty(value = "properties.syncDatabaseId") + private String syncDatabaseId; + + /* + * Last alive time of the sync agent. + */ + @JsonProperty(value = "properties.lastAliveTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastAliveTime; + + /* + * State of the sync agent. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private SyncAgentState state; + + /* + * If the sync agent version is up to date. + */ + @JsonProperty(value = "properties.isUpToDate", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUpToDate; + + /* + * Expiration time of the sync agent version. + */ + @JsonProperty(value = "properties.expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expiryTime; + + /* + * Version of the sync agent. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get the namePropertiesName property: Name of the sync agent. + * + * @return the namePropertiesName value. + */ + public String namePropertiesName() { + return this.namePropertiesName; + } + + /** + * Get the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value. + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @param syncDatabaseId the syncDatabaseId value to set. + * @return the SyncAgentInner object itself. + */ + public SyncAgentInner withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get the lastAliveTime property: Last alive time of the sync agent. + * + * @return the lastAliveTime value. + */ + public OffsetDateTime lastAliveTime() { + return this.lastAliveTime; + } + + /** + * Get the state property: State of the sync agent. + * + * @return the state value. + */ + public SyncAgentState state() { + return this.state; + } + + /** + * Get the isUpToDate property: If the sync agent version is up to date. + * + * @return the isUpToDate value. + */ + public Boolean isUpToDate() { + return this.isUpToDate; + } + + /** + * Get the expiryTime property: Expiration time of the sync agent version. + * + * @return the expiryTime value. + */ + public OffsetDateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the version property: Version of the sync agent. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.java new file mode 100644 index 0000000000000..b93dc3f0a263c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Azure SQL Database sync agent key. */ +@Immutable +public final class SyncAgentKeyPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncAgentKeyPropertiesInner.class); + + /* + * Key of sync agent. + */ + @JsonProperty(value = "syncAgentKey", access = JsonProperty.Access.WRITE_ONLY) + private String syncAgentKey; + + /** + * Get the syncAgentKey property: Key of sync agent. + * + * @return the syncAgentKey value. + */ + public String syncAgentKey() { + return this.syncAgentKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.java new file mode 100644 index 0000000000000..fca33c09ee8c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure SQL Database sync agent linked database. */ +@JsonFlatten +@Immutable +public class SyncAgentLinkedDatabaseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncAgentLinkedDatabaseInner.class); + + /* + * Type of the sync agent linked database. + */ + @JsonProperty(value = "properties.databaseType", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberDbType databaseType; + + /* + * Id of the sync agent linked database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private String databaseId; + + /* + * Description of the sync agent linked database. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Server name of the sync agent linked database. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name of the sync agent linked database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * User name of the sync agent linked database. + */ + @JsonProperty(value = "properties.userName", access = JsonProperty.Access.WRITE_ONLY) + private String username; + + /** + * Get the databaseType property: Type of the sync agent linked database. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Get the databaseId property: Id of the sync agent linked database. + * + * @return the databaseId value. + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Get the description property: Description of the sync agent linked database. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the serverName property: Server name of the sync agent linked database. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName property: Database name of the sync agent linked database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the username property: User name of the sync agent linked database. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.java new file mode 100644 index 0000000000000..6df6e8ea07397 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the sync database id. */ +@Immutable +public final class SyncDatabaseIdPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncDatabaseIdPropertiesInner.class); + + /* + * ARM resource id of sync database. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: ARM resource id of sync database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.java new file mode 100644 index 0000000000000..b49cf6f24571a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaTable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of the database full schema. */ +@Immutable +public final class SyncFullSchemaPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncFullSchemaPropertiesInner.class); + + /* + * List of tables in the database full schema. + */ + @JsonProperty(value = "tables", access = JsonProperty.Access.WRITE_ONLY) + private List tables; + + /* + * Last update time of the database schema. + */ + @JsonProperty(value = "lastUpdateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdateTime; + + /** + * Get the tables property: List of tables in the database full schema. + * + * @return the tables value. + */ + public List tables() { + return this.tables; + } + + /** + * Get the lastUpdateTime property: Last update time of the database schema. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tables() != null) { + tables().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java new file mode 100644 index 0000000000000..ebb6758059e9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroupSchema; +import com.azure.resourcemanager.sql.generated.models.SyncGroupState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An Azure SQL Database sync group. */ +@JsonFlatten +@Fluent +public class SyncGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupInner.class); + + /* + * Sync interval of the sync group. + */ + @JsonProperty(value = "properties.interval") + private Integer interval; + + /* + * Last sync time of the sync group. + */ + @JsonProperty(value = "properties.lastSyncTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastSyncTime; + + /* + * Conflict resolution policy of the sync group. + */ + @JsonProperty(value = "properties.conflictResolutionPolicy") + private SyncConflictResolutionPolicy conflictResolutionPolicy; + + /* + * ARM resource id of the sync database in the sync group. + */ + @JsonProperty(value = "properties.syncDatabaseId") + private String syncDatabaseId; + + /* + * User name for the sync group hub database credential. + */ + @JsonProperty(value = "properties.hubDatabaseUserName") + private String hubDatabaseUsername; + + /* + * Password for the sync group hub database credential. + */ + @JsonProperty(value = "properties.hubDatabasePassword") + private String hubDatabasePassword; + + /* + * Sync state of the sync group. + */ + @JsonProperty(value = "properties.syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupState syncState; + + /* + * Sync schema of the sync group. + */ + @JsonProperty(value = "properties.schema") + private SyncGroupSchema schema; + + /* + * If use private link connection is enabled. + */ + @JsonProperty(value = "properties.usePrivateLinkConnection") + private Boolean usePrivateLinkConnection; + + /* + * Private endpoint name of the sync group if use private link connection + * is enabled. + */ + @JsonProperty(value = "properties.privateEndpointName", access = JsonProperty.Access.WRITE_ONLY) + private String privateEndpointName; + + /** + * Get the interval property: Sync interval of the sync group. + * + * @return the interval value. + */ + public Integer interval() { + return this.interval; + } + + /** + * Set the interval property: Sync interval of the sync group. + * + * @param interval the interval value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Get the lastSyncTime property: Last sync time of the sync group. + * + * @return the lastSyncTime value. + */ + public OffsetDateTime lastSyncTime() { + return this.lastSyncTime; + } + + /** + * Get the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @return the conflictResolutionPolicy value. + */ + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get the syncDatabaseId property: ARM resource id of the sync database in the sync group. + * + * @return the syncDatabaseId value. + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set the syncDatabaseId property: ARM resource id of the sync database in the sync group. + * + * @param syncDatabaseId the syncDatabaseId value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get the hubDatabaseUsername property: User name for the sync group hub database credential. + * + * @return the hubDatabaseUsername value. + */ + public String hubDatabaseUsername() { + return this.hubDatabaseUsername; + } + + /** + * Set the hubDatabaseUsername property: User name for the sync group hub database credential. + * + * @param hubDatabaseUsername the hubDatabaseUsername value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withHubDatabaseUsername(String hubDatabaseUsername) { + this.hubDatabaseUsername = hubDatabaseUsername; + return this; + } + + /** + * Get the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @return the hubDatabasePassword value. + */ + public String hubDatabasePassword() { + return this.hubDatabasePassword; + } + + /** + * Set the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @param hubDatabasePassword the hubDatabasePassword value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withHubDatabasePassword(String hubDatabasePassword) { + this.hubDatabasePassword = hubDatabasePassword; + return this; + } + + /** + * Get the syncState property: Sync state of the sync group. + * + * @return the syncState value. + */ + public SyncGroupState syncState() { + return this.syncState; + } + + /** + * Get the schema property: Sync schema of the sync group. + * + * @return the schema value. + */ + public SyncGroupSchema schema() { + return this.schema; + } + + /** + * Set the schema property: Sync schema of the sync group. + * + * @param schema the schema value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSchema(SyncGroupSchema schema) { + this.schema = schema; + return this; + } + + /** + * Get the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.usePrivateLinkConnection; + } + + /** + * Set the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @param usePrivateLinkConnection the usePrivateLinkConnection value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.usePrivateLinkConnection = usePrivateLinkConnection; + return this; + } + + /** + * Get the privateEndpointName property: Private endpoint name of the sync group if use private link connection is + * enabled. + * + * @return the privateEndpointName value. + */ + public String privateEndpointName() { + return this.privateEndpointName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schema() != null) { + schema().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.java new file mode 100644 index 0000000000000..667ea50b8dde8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Properties of an Azure SQL Database sync group log. */ +@Immutable +public final class SyncGroupLogPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupLogPropertiesInner.class); + + /* + * Timestamp of the sync group log. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * Type of the sync group log. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupLogType type; + + /* + * Source of the sync group log. + */ + @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) + private String source; + + /* + * Details of the sync group log. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private String details; + + /* + * TracingId of the sync group log. + */ + @JsonProperty(value = "tracingId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tracingId; + + /* + * OperationStatus of the sync group log. + */ + @JsonProperty(value = "operationStatus", access = JsonProperty.Access.WRITE_ONLY) + private String operationStatus; + + /** + * Get the timestamp property: Timestamp of the sync group log. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the type property: Type of the sync group log. + * + * @return the type value. + */ + public SyncGroupLogType type() { + return this.type; + } + + /** + * Get the source property: Source of the sync group log. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Get the details property: Details of the sync group log. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Get the tracingId property: TracingId of the sync group log. + * + * @return the tracingId value. + */ + public UUID tracingId() { + return this.tracingId; + } + + /** + * Get the operationStatus property: OperationStatus of the sync group log. + * + * @return the operationStatus value. + */ + public String operationStatus() { + return this.operationStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java new file mode 100644 index 0000000000000..0bf721969c0e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.azure.resourcemanager.sql.generated.models.SyncMemberState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** An Azure SQL Database sync member. */ +@JsonFlatten +@Fluent +public class SyncMemberInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncMemberInner.class); + + /* + * Database type of the sync member. + */ + @JsonProperty(value = "properties.databaseType") + private SyncMemberDbType databaseType; + + /* + * ARM resource id of the sync agent in the sync member. + */ + @JsonProperty(value = "properties.syncAgentId") + private String syncAgentId; + + /* + * SQL Server database id of the sync member. + */ + @JsonProperty(value = "properties.sqlServerDatabaseId") + private UUID sqlServerDatabaseId; + + /* + * ARM resource id of the sync member logical database, for sync members in + * Azure. + */ + @JsonProperty(value = "properties.syncMemberAzureDatabaseResourceId") + private String syncMemberAzureDatabaseResourceId; + + /* + * Whether to use private link connection. + */ + @JsonProperty(value = "properties.usePrivateLinkConnection") + private Boolean usePrivateLinkConnection; + + /* + * Private endpoint name of the sync member if use private link connection + * is enabled, for sync members in Azure. + */ + @JsonProperty(value = "properties.privateEndpointName", access = JsonProperty.Access.WRITE_ONLY) + private String privateEndpointName; + + /* + * Server name of the member database in the sync member + */ + @JsonProperty(value = "properties.serverName") + private String serverName; + + /* + * Database name of the member database in the sync member. + */ + @JsonProperty(value = "properties.databaseName") + private String databaseName; + + /* + * User name of the member database in the sync member. + */ + @JsonProperty(value = "properties.userName") + private String username; + + /* + * Password of the member database in the sync member. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * Sync direction of the sync member. + */ + @JsonProperty(value = "properties.syncDirection") + private SyncDirection syncDirection; + + /* + * Sync state of the sync member. + */ + @JsonProperty(value = "properties.syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberState syncState; + + /** + * Get the databaseType property: Database type of the sync member. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Set the databaseType property: Database type of the sync member. + * + * @param databaseType the databaseType value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withDatabaseType(SyncMemberDbType databaseType) { + this.databaseType = databaseType; + return this; + } + + /** + * Get the syncAgentId property: ARM resource id of the sync agent in the sync member. + * + * @return the syncAgentId value. + */ + public String syncAgentId() { + return this.syncAgentId; + } + + /** + * Set the syncAgentId property: ARM resource id of the sync agent in the sync member. + * + * @param syncAgentId the syncAgentId value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncAgentId(String syncAgentId) { + this.syncAgentId = syncAgentId; + return this; + } + + /** + * Get the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value. + */ + public UUID sqlServerDatabaseId() { + return this.sqlServerDatabaseId; + } + + /** + * Set the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @param sqlServerDatabaseId the sqlServerDatabaseId value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.sqlServerDatabaseId = sqlServerDatabaseId; + return this; + } + + /** + * Get the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for sync + * members in Azure. + * + * @return the syncMemberAzureDatabaseResourceId value. + */ + public String syncMemberAzureDatabaseResourceId() { + return this.syncMemberAzureDatabaseResourceId; + } + + /** + * Set the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for sync + * members in Azure. + * + * @param syncMemberAzureDatabaseResourceId the syncMemberAzureDatabaseResourceId value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId) { + this.syncMemberAzureDatabaseResourceId = syncMemberAzureDatabaseResourceId; + return this; + } + + /** + * Get the usePrivateLinkConnection property: Whether to use private link connection. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.usePrivateLinkConnection; + } + + /** + * Set the usePrivateLinkConnection property: Whether to use private link connection. + * + * @param usePrivateLinkConnection the usePrivateLinkConnection value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.usePrivateLinkConnection = usePrivateLinkConnection; + return this; + } + + /** + * Get the privateEndpointName property: Private endpoint name of the sync member if use private link connection is + * enabled, for sync members in Azure. + * + * @return the privateEndpointName value. + */ + public String privateEndpointName() { + return this.privateEndpointName; + } + + /** + * Get the serverName property: Server name of the member database in the sync member. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName property: Server name of the member database in the sync member. + * + * @param serverName the serverName value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName property: Database name of the member database in the sync member. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: Database name of the member database in the sync member. + * + * @param databaseName the databaseName value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the username property: User name of the member database in the sync member. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: User name of the member database in the sync member. + * + * @param username the username value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Password of the member database in the sync member. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Password of the member database in the sync member. + * + * @param password the password value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the syncDirection property: Sync direction of the sync member. + * + * @return the syncDirection value. + */ + public SyncDirection syncDirection() { + return this.syncDirection; + } + + /** + * Set the syncDirection property: Sync direction of the sync member. + * + * @param syncDirection the syncDirection value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncDirection(SyncDirection syncDirection) { + this.syncDirection = syncDirection; + return this; + } + + /** + * Get the syncState property: Sync state of the sync member. + * + * @return the syncState value. + */ + public SyncMemberState syncState() { + return this.syncState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.java new file mode 100644 index 0000000000000..0e019b3d6ddf0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.QueryStatisticsProperties; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The TopQueries model. */ +@Fluent +public final class TopQueriesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopQueriesInner.class); + + /* + * Requested number of top queries. + */ + @JsonProperty(value = "numberOfQueries", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfQueries; + + /* + * Aggregation function used to calculate query metrics. + */ + @JsonProperty(value = "aggregationFunction", access = JsonProperty.Access.WRITE_ONLY) + private String aggregationFunction; + + /* + * Metric used to rank queries. + */ + @JsonProperty(value = "observationMetric", access = JsonProperty.Access.WRITE_ONLY) + private String observationMetric; + + /* + * Interval type (length). + */ + @JsonProperty(value = "intervalType", access = JsonProperty.Access.WRITE_ONLY) + private QueryTimeGrainType intervalType; + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private String startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private String endTime; + + /* + * List of top resource consuming queries with appropriate metric data + */ + @JsonProperty(value = "queries") + private List queries; + + /** + * Get the numberOfQueries property: Requested number of top queries. + * + * @return the numberOfQueries value. + */ + public Integer numberOfQueries() { + return this.numberOfQueries; + } + + /** + * Get the aggregationFunction property: Aggregation function used to calculate query metrics. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.aggregationFunction; + } + + /** + * Get the observationMetric property: Metric used to rank queries. + * + * @return the observationMetric value. + */ + public String observationMetric() { + return this.observationMetric; + } + + /** + * Get the intervalType property: Interval type (length). + * + * @return the intervalType value. + */ + public QueryTimeGrainType intervalType() { + return this.intervalType; + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Get the queries property: List of top resource consuming queries with appropriate metric data. + * + * @return the queries value. + */ + public List queries() { + return this.queries; + } + + /** + * Set the queries property: List of top resource consuming queries with appropriate metric data. + * + * @param queries the queries value to set. + * @return the TopQueriesInner object itself. + */ + public TopQueriesInner withQueries(List queries) { + this.queries = queries; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queries() != null) { + queries().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionActivityInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionActivityInner.java new file mode 100644 index 0000000000000..6d21b4ed64450 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionActivityInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionActivityStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database transparent data encryption Scan. */ +@JsonFlatten +@Immutable +public class TransparentDataEncryptionActivityInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransparentDataEncryptionActivityInner.class); + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private TransparentDataEncryptionActivityStatus status; + + /* + * The percent complete of the transparent data encryption scan for a + * database. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Float percentComplete; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public TransparentDataEncryptionActivityStatus status() { + return this.status; + } + + /** + * Get the percentComplete property: The percent complete of the transparent data encryption scan for a database. + * + * @return the percentComplete value. + */ + public Float percentComplete() { + return this.percentComplete; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..72d18766c340d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database transparent data encryption configuration. */ +@JsonFlatten +@Fluent +public class TransparentDataEncryptionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransparentDataEncryptionInner.class); + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The status of the database transparent data encryption. + */ + @JsonProperty(value = "properties.status") + private TransparentDataEncryptionStatus status; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the status property: The status of the database transparent data encryption. + * + * @return the status value. + */ + public TransparentDataEncryptionStatus status() { + return this.status; + } + + /** + * Set the status property: The status of the database transparent data encryption. + * + * @param status the status value to set. + * @return the TransparentDataEncryptionInner object itself. + */ + public TransparentDataEncryptionInner withStatus(TransparentDataEncryptionStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.java new file mode 100644 index 0000000000000..aeddee75754a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.Name; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ARM usage. */ +@Immutable +public final class UsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageInner.class); + + /* + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private Name name; + + /* + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Usage unit. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * Usage current value. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /* + * Usage limit. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /* + * Usage requested limit. + */ + @JsonProperty(value = "requestedLimit", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedLimit; + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public Name name() { + return this.name; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the unit property: Usage unit. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the currentValue property: Usage current value. + * + * @return the currentValue value. + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: Usage limit. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the requestedLimit property: Usage requested limit. + * + * @return the requestedLimit value. + */ + public Integer requestedLimit() { + return this.requestedLimit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.java new file mode 100644 index 0000000000000..f212f59f2f186 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.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.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure SQL virtual cluster. */ +@JsonFlatten +@Fluent +public class VirtualClusterInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualClusterInner.class); + + /* + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "properties.subnetId", access = JsonProperty.Access.WRITE_ONLY) + private String subnetId; + + /* + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "properties.family") + private String family; + + /* + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "properties.childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /** + * Get the subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * 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 VirtualClusterInner object itself. + */ + public VirtualClusterInner withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + public List childResources() { + return this.childResources; + } + + /** {@inheritDoc} */ + @Override + public VirtualClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualClusterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.java new file mode 100644 index 0000000000000..6ebd4cee56ce9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A virtual network rule. */ +@JsonFlatten +@Fluent +public class VirtualNetworkRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleInner.class); + + /* + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "properties.virtualNetworkSubnetId") + private String virtualNetworkSubnetId; + + /* + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "properties.ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /* + * Virtual Network Rule State + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.java new file mode 100644 index 0000000000000..9d235cce60ac8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A vulnerability assessment scan record. */ +@JsonFlatten +@Immutable +public class VulnerabilityAssessmentScanRecordInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VulnerabilityAssessmentScanRecordInner.class); + + /* + * The scan ID. + */ + @JsonProperty(value = "properties.scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /* + * The scan trigger type. + */ + @JsonProperty(value = "properties.triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /* + * The scan status. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /* + * The scan start time (UTC). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The scan end time (UTC). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The scan errors. + */ + @JsonProperty(value = "properties.errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /* + * The scan results storage container path. + */ + @JsonProperty(value = "properties.storageContainerPath", access = JsonProperty.Access.WRITE_ONLY) + private String storageContainerPath; + + /* + * The number of failed security checks. + */ + @JsonProperty(value = "properties.numberOfFailedSecurityChecks", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFailedSecurityChecks; + + /** + * Get the scanId property: The scan ID. + * + * @return the scanId value. + */ + public String scanId() { + return this.scanId; + } + + /** + * Get the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Get the state property: The scan status. + * + * @return the state value. + */ + public VulnerabilityAssessmentScanState state() { + return this.state; + } + + /** + * Get the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errors property: The scan errors. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Get the storageContainerPath property: The scan results storage container path. + * + * @return the storageContainerPath value. + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Get the numberOfFailedSecurityChecks property: The number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value. + */ + public Integer numberOfFailedSecurityChecks() { + return this.numberOfFailedSecurityChecks; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.java new file mode 100644 index 0000000000000..a888320286f7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload classifier operations for a data warehouse. */ +@JsonFlatten +@Fluent +public class WorkloadClassifierInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkloadClassifierInner.class); + + /* + * The workload classifier member name. + */ + @JsonProperty(value = "properties.memberName") + private String memberName; + + /* + * The workload classifier label. + */ + @JsonProperty(value = "properties.label") + private String label; + + /* + * The workload classifier context. + */ + @JsonProperty(value = "properties.context") + private String context; + + /* + * The workload classifier start time for classification. + */ + @JsonProperty(value = "properties.startTime") + private String startTime; + + /* + * The workload classifier end time for classification. + */ + @JsonProperty(value = "properties.endTime") + private String endTime; + + /* + * The workload classifier importance. + */ + @JsonProperty(value = "properties.importance") + private String importance; + + /** + * Get the memberName property: The workload classifier member name. + * + * @return the memberName value. + */ + public String memberName() { + return this.memberName; + } + + /** + * Set the memberName property: The workload classifier member name. + * + * @param memberName the memberName value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withMemberName(String memberName) { + this.memberName = memberName; + return this; + } + + /** + * Get the label property: The workload classifier label. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Set the label property: The workload classifier label. + * + * @param label the label value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get the context property: The workload classifier context. + * + * @return the context value. + */ + public String context() { + return this.context; + } + + /** + * Set the context property: The workload classifier context. + * + * @param context the context value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withContext(String context) { + this.context = context; + return this; + } + + /** + * Get the startTime property: The workload classifier start time for classification. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The workload classifier start time for classification. + * + * @param startTime the startTime value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The workload classifier end time for classification. + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The workload classifier end time for classification. + * + * @param endTime the endTime value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the importance property: The workload classifier importance. + * + * @return the importance value. + */ + public String importance() { + return this.importance; + } + + /** + * Set the importance property: The workload classifier importance. + * + * @param importance the importance value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withImportance(String importance) { + this.importance = importance; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.java new file mode 100644 index 0000000000000..57d8098e5f383 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload group operations for a data warehouse. */ +@JsonFlatten +@Fluent +public class WorkloadGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkloadGroupInner.class); + + /* + * The workload group minimum percentage resource. + */ + @JsonProperty(value = "properties.minResourcePercent") + private Integer minResourcePercent; + + /* + * The workload group cap percentage resource. + */ + @JsonProperty(value = "properties.maxResourcePercent") + private Integer maxResourcePercent; + + /* + * The workload group request minimum grant percentage. + */ + @JsonProperty(value = "properties.minResourcePercentPerRequest") + private Double minResourcePercentPerRequest; + + /* + * The workload group request maximum grant percentage. + */ + @JsonProperty(value = "properties.maxResourcePercentPerRequest") + private Double maxResourcePercentPerRequest; + + /* + * The workload group importance level. + */ + @JsonProperty(value = "properties.importance") + private String importance; + + /* + * The workload group query execution timeout. + */ + @JsonProperty(value = "properties.queryExecutionTimeout") + private Integer queryExecutionTimeout; + + /** + * Get the minResourcePercent property: The workload group minimum percentage resource. + * + * @return the minResourcePercent value. + */ + public Integer minResourcePercent() { + return this.minResourcePercent; + } + + /** + * Set the minResourcePercent property: The workload group minimum percentage resource. + * + * @param minResourcePercent the minResourcePercent value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMinResourcePercent(Integer minResourcePercent) { + this.minResourcePercent = minResourcePercent; + return this; + } + + /** + * Get the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + public Integer maxResourcePercent() { + return this.maxResourcePercent; + } + + /** + * Set the maxResourcePercent property: The workload group cap percentage resource. + * + * @param maxResourcePercent the maxResourcePercent value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMaxResourcePercent(Integer maxResourcePercent) { + this.maxResourcePercent = maxResourcePercent; + return this; + } + + /** + * Get the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @return the minResourcePercentPerRequest value. + */ + public Double minResourcePercentPerRequest() { + return this.minResourcePercentPerRequest; + } + + /** + * Set the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @param minResourcePercentPerRequest the minResourcePercentPerRequest value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMinResourcePercentPerRequest(Double minResourcePercentPerRequest) { + this.minResourcePercentPerRequest = minResourcePercentPerRequest; + return this; + } + + /** + * Get the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @return the maxResourcePercentPerRequest value. + */ + public Double maxResourcePercentPerRequest() { + return this.maxResourcePercentPerRequest; + } + + /** + * Set the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @param maxResourcePercentPerRequest the maxResourcePercentPerRequest value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest) { + this.maxResourcePercentPerRequest = maxResourcePercentPerRequest; + return this; + } + + /** + * Get the importance property: The workload group importance level. + * + * @return the importance value. + */ + public String importance() { + return this.importance; + } + + /** + * Set the importance property: The workload group importance level. + * + * @param importance the importance value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withImportance(String importance) { + this.importance = importance; + return this; + } + + /** + * Get the queryExecutionTimeout property: The workload group query execution timeout. + * + * @return the queryExecutionTimeout value. + */ + public Integer queryExecutionTimeout() { + return this.queryExecutionTimeout; + } + + /** + * Set the queryExecutionTimeout property: The workload group query execution timeout. + * + * @param queryExecutionTimeout the queryExecutionTimeout value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withQueryExecutionTimeout(Integer queryExecutionTimeout) { + this.queryExecutionTimeout = queryExecutionTimeout; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..ebc86f768cad9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// 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 SqlManagementClient. The Azure SQL Database management API provides a + * RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables + * you to create, retrieve, update, and delete databases. + */ +package com.azure.resourcemanager.sql.generated.fluent.models; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/package-info.java new file mode 100644 index 0000000000000..bbe2809928add --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/package-info.java @@ -0,0 +1,10 @@ +// 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 SqlManagementClient. The Azure SQL Database management API provides a + * RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables + * you to create, retrieve, update, and delete databases. + */ +package com.azure.resourcemanager.sql.generated.fluent; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..61ce18203fc02 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.BackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BackupShortTermRetentionPoliciesClient. + */ +public final class BackupShortTermRetentionPoliciesClientImpl implements BackupShortTermRetentionPoliciesClient { + private final ClientLogger logger = new ClientLogger(BackupShortTermRetentionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BackupShortTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupShortTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BackupShortTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + BackupShortTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientBackupShortTermRetentionPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientB") + private interface BackupShortTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ShortTermRetentionPolicyName policyName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + return getAsync(resourceGroupName, serverName, databaseName, policyName).block(); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, context).block(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).block(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).getSyncPoller(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).block(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context).block(); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 short term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 short term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..7a5b072add18e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.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.sql.generated.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.sql.generated.fluent.BackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BackupShortTermRetentionPoliciesImpl implements BackupShortTermRetentionPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupShortTermRetentionPoliciesImpl.class); + + private final BackupShortTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public BackupShortTermRetentionPoliciesImpl( + BackupShortTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public BackupShortTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + BackupShortTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, policyName); + if (inner != null) { + return new BackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BackupShortTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new BackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new BackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public BackupShortTermRetentionPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + ShortTermRetentionPolicyName policyName = + ShortTermRetentionPolicyName.fromString(Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + ShortTermRetentionPolicyName policyName = + ShortTermRetentionPolicyName.fromString(Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + } + + private BackupShortTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public BackupShortTermRetentionPolicyImpl define(ShortTermRetentionPolicyName name) { + return new BackupShortTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..8ac3880ea32c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +public final class BackupShortTermRetentionPolicyImpl + implements BackupShortTermRetentionPolicy, + BackupShortTermRetentionPolicy.Definition, + BackupShortTermRetentionPolicy.Update { + private BackupShortTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public BackupShortTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private ShortTermRetentionPolicyName policyName; + + public BackupShortTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public BackupShortTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public BackupShortTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + BackupShortTermRetentionPolicyImpl( + ShortTermRetentionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new BackupShortTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public BackupShortTermRetentionPolicyImpl update() { + return this; + } + + public BackupShortTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .update(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public BackupShortTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .update(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + BackupShortTermRetentionPolicyImpl( + BackupShortTermRetentionPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + ShortTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupShortTermRetentionPolicies")); + } + + public BackupShortTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public BackupShortTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, context) + .getValue(); + return this; + } + + public BackupShortTermRetentionPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.java new file mode 100644 index 0000000000000..666abf6b6f872 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.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.sql.generated.fluent.CapabilitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.CapabilityGroup; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CapabilitiesClient. */ +public final class CapabilitiesClientImpl implements CapabilitiesClient { + private final ClientLogger logger = new ClientLogger(CapabilitiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CapabilitiesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of CapabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CapabilitiesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(CapabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientCapabilities to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientC") + private interface CapabilitiesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("include") CapabilityGroup include, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationWithResponseAsync( + String locationName, CapabilityGroup include) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + include, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. + * @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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationWithResponseAsync( + String locationName, CapabilityGroup include, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + locationName, + include, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByLocationAsync(String locationName, CapabilityGroup include) { + return listByLocationWithResponseAsync(locationName, include) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByLocationAsync(String locationName) { + final CapabilityGroup include = null; + return listByLocationWithResponseAsync(locationName, include) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LocationCapabilitiesInner listByLocation(String locationName) { + final CapabilityGroup include = null; + return listByLocationAsync(locationName, include).block(); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. + * @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 subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context) { + return listByLocationWithResponseAsync(locationName, include, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..62d378887fd75 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.CapabilitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.Capabilities; +import com.azure.resourcemanager.sql.generated.models.CapabilityGroup; +import com.azure.resourcemanager.sql.generated.models.LocationCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CapabilitiesImpl implements Capabilities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilitiesImpl.class); + + private final CapabilitiesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public CapabilitiesImpl( + CapabilitiesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LocationCapabilities listByLocation(String locationName) { + LocationCapabilitiesInner inner = this.serviceClient().listByLocation(locationName); + if (inner != null) { + return new LocationCapabilitiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context) { + Response inner = + this.serviceClient().listByLocationWithResponse(locationName, include, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LocationCapabilitiesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CapabilitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..7cf6c13597372 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CheckNameAvailabilityResponseImpl.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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + CheckNameAvailabilityResponseImpl( + CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean available() { + return this.innerModel().available(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java new file mode 100644 index 0000000000000..daf66066982af --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.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.sql.generated.fluent.DataMaskingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataMaskingPoliciesClient. */ +public final class DataMaskingPoliciesClientImpl implements DataMaskingPoliciesClient { + private final ClientLogger logger = new ClientLogger(DataMaskingPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DataMaskingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataMaskingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DataMaskingPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDataMaskingPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DataMaskingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @BodyParam("application/json") DataMaskingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters Parameters for creating or updating a data masking policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters Parameters for creating or updating a data masking policy. + * @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 represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataMaskingPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + parameters, + accept, + context); + } + + /** + * Creates or updates a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters Parameters for creating or updating a data masking policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters Parameters for creating or updating a data masking policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataMaskingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Creates or updates a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters Parameters for creating or updating a data masking policy. + * @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 represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataMaskingPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context) + .block(); + } + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context); + } + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataMaskingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.java new file mode 100644 index 0000000000000..6fc799a8a8b74 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicies; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataMaskingPoliciesImpl implements DataMaskingPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataMaskingPoliciesImpl.class); + + private final DataMaskingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DataMaskingPoliciesImpl( + DataMaskingPoliciesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DataMaskingPolicy get(String resourceGroupName, String serverName, String databaseName) { + DataMaskingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DataMaskingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataMaskingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataMaskingPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, context); + } + + private DataMaskingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DataMaskingPolicyImpl define() { + return new DataMaskingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPolicyImpl.java new file mode 100644 index 0000000000000..41a14293868b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPolicyImpl.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.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicy; +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; + +public final class DataMaskingPolicyImpl + implements DataMaskingPolicy, DataMaskingPolicy.Definition, DataMaskingPolicy.Update { + private DataMaskingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 String kind() { + return this.innerModel().kind(); + } + + public DataMaskingState dataMaskingState() { + return this.innerModel().dataMaskingState(); + } + + public String exemptPrincipals() { + return this.innerModel().exemptPrincipals(); + } + + public String applicationPrincipals() { + return this.innerModel().applicationPrincipals(); + } + + public String maskingLevel() { + return this.innerModel().maskingLevel(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DataMaskingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public DataMaskingPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DataMaskingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DataMaskingPolicyInner(); + this.serviceManager = serviceManager; + } + + public DataMaskingPolicyImpl update() { + return this; + } + + public DataMaskingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingPolicyImpl( + DataMaskingPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public DataMaskingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public DataMaskingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public DataMaskingPolicyImpl withDataMaskingState(DataMaskingState dataMaskingState) { + this.innerModel().withDataMaskingState(dataMaskingState); + return this; + } + + public DataMaskingPolicyImpl withExemptPrincipals(String exemptPrincipals) { + this.innerModel().withExemptPrincipals(exemptPrincipals); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRuleImpl.java new file mode 100644 index 0000000000000..cba3fba7a276d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRuleImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRule; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; + +public final class DataMaskingRuleImpl implements DataMaskingRule, DataMaskingRule.Definition, DataMaskingRule.Update { + private DataMaskingRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 String kind() { + return this.innerModel().kind(); + } + + public String idPropertiesId() { + return this.innerModel().idPropertiesId(); + } + + public String aliasName() { + return this.innerModel().aliasName(); + } + + public DataMaskingRuleState ruleState() { + return this.innerModel().ruleState(); + } + + public String schemaName() { + return this.innerModel().schemaName(); + } + + public String tableName() { + return this.innerModel().tableName(); + } + + public String columnName() { + return this.innerModel().columnName(); + } + + public DataMaskingFunction maskingFunction() { + return this.innerModel().maskingFunction(); + } + + public String numberFrom() { + return this.innerModel().numberFrom(); + } + + public String numberTo() { + return this.innerModel().numberTo(); + } + + public String prefixSize() { + return this.innerModel().prefixSize(); + } + + public String suffixSize() { + return this.innerModel().suffixSize(); + } + + public String replacementString() { + return this.innerModel().replacementString(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DataMaskingRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String dataMaskingRuleName; + + public DataMaskingRuleImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DataMaskingRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DataMaskingRuleInner(); + this.serviceManager = serviceManager; + this.dataMaskingRuleName = name; + } + + public DataMaskingRuleImpl update() { + return this; + } + + public DataMaskingRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingRuleImpl( + DataMaskingRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.dataMaskingRuleName = Utils.getValueFromIdByName(innerObject.id(), "rules"); + } + + public DataMaskingRuleImpl withAliasName(String aliasName) { + this.innerModel().withAliasName(aliasName); + return this; + } + + public DataMaskingRuleImpl withRuleState(DataMaskingRuleState ruleState) { + this.innerModel().withRuleState(ruleState); + return this; + } + + public DataMaskingRuleImpl withSchemaName(String schemaName) { + this.innerModel().withSchemaName(schemaName); + return this; + } + + public DataMaskingRuleImpl withTableName(String tableName) { + this.innerModel().withTableName(tableName); + return this; + } + + public DataMaskingRuleImpl withColumnName(String columnName) { + this.innerModel().withColumnName(columnName); + return this; + } + + public DataMaskingRuleImpl withMaskingFunction(DataMaskingFunction maskingFunction) { + this.innerModel().withMaskingFunction(maskingFunction); + return this; + } + + public DataMaskingRuleImpl withNumberFrom(String numberFrom) { + this.innerModel().withNumberFrom(numberFrom); + return this; + } + + public DataMaskingRuleImpl withNumberTo(String numberTo) { + this.innerModel().withNumberTo(numberTo); + return this; + } + + public DataMaskingRuleImpl withPrefixSize(String prefixSize) { + this.innerModel().withPrefixSize(prefixSize); + return this; + } + + public DataMaskingRuleImpl withSuffixSize(String suffixSize) { + this.innerModel().withSuffixSize(suffixSize); + return this; + } + + public DataMaskingRuleImpl withReplacementString(String replacementString) { + this.innerModel().withReplacementString(replacementString); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java new file mode 100644 index 0000000000000..e02bdfa6e1eca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java @@ -0,0 +1,529 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.sql.generated.fluent.DataMaskingRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataMaskingRulesClient. */ +public final class DataMaskingRulesClientImpl implements DataMaskingRulesClient { + private final ClientLogger logger = new ClientLogger(DataMaskingRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DataMaskingRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataMaskingRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DataMaskingRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDataMaskingRules to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DataMaskingRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules" + + "/{dataMaskingRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @PathParam("dataMaskingRuleName") String dataMaskingRuleName, + @BodyParam("application/json") DataMaskingRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (dataMaskingRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataMaskingRuleName 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 apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + dataMaskingRuleName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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 represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (dataMaskingRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataMaskingRuleName 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 apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + dataMaskingRuleName, + parameters, + accept, + context); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataMaskingRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters) + .block(); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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 represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters, context) + .block(); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database data masking rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database data masking rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database data masking rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.java new file mode 100644 index 0000000000000..d01d880dfc523 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.DataMaskingRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRule; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataMaskingRulesImpl implements DataMaskingRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataMaskingRulesImpl.class); + + private final DataMaskingRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DataMaskingRulesImpl( + DataMaskingRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DataMaskingRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DataMaskingRuleImpl(inner1, this.manager())); + } + + private DataMaskingRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DataMaskingRuleImpl define(String name) { + return new DataMaskingRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningImpl.java new file mode 100644 index 0000000000000..04ecacce7065b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTuning; +import java.util.Collections; +import java.util.Map; + +public final class DatabaseAutomaticTuningImpl implements DatabaseAutomaticTuning { + private DatabaseAutomaticTuningInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseAutomaticTuningImpl( + DatabaseAutomaticTuningInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AutomaticTuningMode desiredState() { + return this.innerModel().desiredState(); + } + + public AutomaticTuningMode actualState() { + return this.innerModel().actualState(); + } + + public Map options() { + Map inner = this.innerModel().options(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public DatabaseAutomaticTuningInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java new file mode 100644 index 0000000000000..35e90a51287a1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java @@ -0,0 +1,459 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAutomaticTuningsClient. */ +public final class DatabaseAutomaticTuningsClientImpl implements DatabaseAutomaticTuningsClient { + private final ClientLogger logger = new ClientLogger(DatabaseAutomaticTuningsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseAutomaticTuningsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAutomaticTuningsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAutomaticTuningsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(DatabaseAutomaticTuningsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseAutomaticTunings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseAutomaticTuningsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAutomaticTuningInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAutomaticTuningInner get(String resourceGroupName, String serverName, String databaseName) { + return getAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @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 database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAutomaticTuningInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @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 database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..31c03cd6396e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTuning; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTunings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseAutomaticTuningsImpl implements DatabaseAutomaticTunings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAutomaticTuningsImpl.class); + + private final DatabaseAutomaticTuningsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseAutomaticTuningsImpl( + DatabaseAutomaticTuningsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseAutomaticTuning get(String resourceGroupName, String serverName, String databaseName) { + DatabaseAutomaticTuningInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAutomaticTuning update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + DatabaseAutomaticTuningInner inner = + this.serviceClient().update(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new DatabaseAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DatabaseAutomaticTuningsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..4d94728241310 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,778 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.sql.generated.fluent.DatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicyListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseBlobAuditingPoliciesClient. */ +public final class DatabaseBlobAuditingPoliciesClientImpl implements DatabaseBlobAuditingPoliciesClient { + private final ClientLogger logger = new ClientLogger(DatabaseBlobAuditingPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseBlobAuditingPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseBlobAuditingPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/auditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Creates or updates a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database blob auditing policy. + * @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 database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Creates or updates a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database blob auditing policy. + * @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 database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseBlobAuditingPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context) + .block(); + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + 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 auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(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 database auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..2906933251256 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.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.sql.generated.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.sql.generated.fluent.DatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseBlobAuditingPoliciesImpl implements DatabaseBlobAuditingPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseBlobAuditingPoliciesImpl.class); + + private final DatabaseBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseBlobAuditingPoliciesImpl( + DatabaseBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName) { + DatabaseBlobAuditingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public DatabaseBlobAuditingPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, context); + } + + private DatabaseBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseBlobAuditingPolicyImpl define() { + return new DatabaseBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..0e7f507248212 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class DatabaseBlobAuditingPolicyImpl + implements DatabaseBlobAuditingPolicy, DatabaseBlobAuditingPolicy.Definition, DatabaseBlobAuditingPolicy.Update { + private DatabaseBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public DatabaseBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public DatabaseBlobAuditingPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DatabaseBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public DatabaseBlobAuditingPolicyImpl update() { + return this; + } + + public DatabaseBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseBlobAuditingPolicyImpl( + DatabaseBlobAuditingPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public DatabaseBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..b23ed7bdbe975 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java @@ -0,0 +1,568 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.CurrentBackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.DatabaseReadScale; +import com.azure.resourcemanager.sql.generated.models.DatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.DatabaseUpdate; +import com.azure.resourcemanager.sql.generated.models.RequestedBackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +public final class DatabaseImpl implements Database, Database.Definition, Database.Update { + private DatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public CreateMode createMode() { + return this.innerModel().createMode(); + } + + public String collation() { + return this.innerModel().collation(); + } + + public Long maxSizeBytes() { + return this.innerModel().maxSizeBytes(); + } + + public SampleName sampleName() { + return this.innerModel().sampleName(); + } + + public String elasticPoolId() { + return this.innerModel().elasticPoolId(); + } + + public String sourceDatabaseId() { + return this.innerModel().sourceDatabaseId(); + } + + public DatabaseStatus status() { + return this.innerModel().status(); + } + + public UUID databaseId() { + return this.innerModel().databaseId(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public String currentServiceObjectiveName() { + return this.innerModel().currentServiceObjectiveName(); + } + + public String requestedServiceObjectiveName() { + return this.innerModel().requestedServiceObjectiveName(); + } + + public String defaultSecondaryLocation() { + return this.innerModel().defaultSecondaryLocation(); + } + + public String failoverGroupId() { + return this.innerModel().failoverGroupId(); + } + + public OffsetDateTime restorePointInTime() { + return this.innerModel().restorePointInTime(); + } + + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.innerModel().sourceDatabaseDeletionDate(); + } + + public String recoveryServicesRecoveryPointId() { + return this.innerModel().recoveryServicesRecoveryPointId(); + } + + public String longTermRetentionBackupResourceId() { + return this.innerModel().longTermRetentionBackupResourceId(); + } + + public String recoverableDatabaseId() { + return this.innerModel().recoverableDatabaseId(); + } + + public String restorableDroppedDatabaseId() { + return this.innerModel().restorableDroppedDatabaseId(); + } + + public CatalogCollationType catalogCollation() { + return this.innerModel().catalogCollation(); + } + + public Boolean zoneRedundant() { + return this.innerModel().zoneRedundant(); + } + + public DatabaseLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public Long maxLogSizeBytes() { + return this.innerModel().maxLogSizeBytes(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public DatabaseReadScale readScale() { + return this.innerModel().readScale(); + } + + public Integer highAvailabilityReplicaCount() { + return this.innerModel().highAvailabilityReplicaCount(); + } + + public SecondaryType secondaryType() { + return this.innerModel().secondaryType(); + } + + public Sku currentSku() { + return this.innerModel().currentSku(); + } + + public Integer autoPauseDelay() { + return this.innerModel().autoPauseDelay(); + } + + public CurrentBackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerModel().currentBackupStorageRedundancy(); + } + + public RequestedBackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerModel().requestedBackupStorageRedundancy(); + } + + public Double minCapacity() { + return this.innerModel().minCapacity(); + } + + public OffsetDateTime pausedDate() { + return this.innerModel().pausedDate(); + } + + public OffsetDateTime resumedDate() { + return this.innerModel().resumedDate(); + } + + public String maintenanceConfigurationId() { + return this.innerModel().maintenanceConfigurationId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private DatabaseUpdate updateParameters; + + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public Database create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public Database create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); + return this; + } + + DatabaseImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public DatabaseImpl update() { + this.updateParameters = new DatabaseUpdate(); + return this; + } + + public Database apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .update(resourceGroupName, serverName, databaseName, updateParameters, Context.NONE); + return this; + } + + public Database apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .update(resourceGroupName, serverName, databaseName, updateParameters, context); + return this; + } + + DatabaseImpl(DatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public Database refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public Database refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public DatabaseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DatabaseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public DatabaseImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public DatabaseImpl withCreateMode(CreateMode createMode) { + if (isInCreateMode()) { + this.innerModel().withCreateMode(createMode); + return this; + } else { + this.updateParameters.withCreateMode(createMode); + return this; + } + } + + public DatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.innerModel().withCollation(collation); + return this; + } else { + this.updateParameters.withCollation(collation); + return this; + } + } + + public DatabaseImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.innerModel().withMaxSizeBytes(maxSizeBytes); + return this; + } else { + this.updateParameters.withMaxSizeBytes(maxSizeBytes); + return this; + } + } + + public DatabaseImpl withSampleName(SampleName sampleName) { + if (isInCreateMode()) { + this.innerModel().withSampleName(sampleName); + return this; + } else { + this.updateParameters.withSampleName(sampleName); + return this; + } + } + + public DatabaseImpl withElasticPoolId(String elasticPoolId) { + if (isInCreateMode()) { + this.innerModel().withElasticPoolId(elasticPoolId); + return this; + } else { + this.updateParameters.withElasticPoolId(elasticPoolId); + return this; + } + } + + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.innerModel().withSourceDatabaseId(sourceDatabaseId); + return this; + } else { + this.updateParameters.withSourceDatabaseId(sourceDatabaseId); + return this; + } + } + + public DatabaseImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + if (isInCreateMode()) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } else { + this.updateParameters.withRestorePointInTime(restorePointInTime); + return this; + } + } + + public DatabaseImpl withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + if (isInCreateMode()) { + this.innerModel().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + return this; + } else { + this.updateParameters.withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + return this; + } + } + + public DatabaseImpl withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + if (isInCreateMode()) { + this.innerModel().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + return this; + } else { + this.updateParameters.withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + return this; + } + } + + public DatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (isInCreateMode()) { + this.innerModel().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } else { + this.updateParameters.withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + } + + public DatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.innerModel().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } else { + this.updateParameters.withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + } + + public DatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.innerModel().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } else { + this.updateParameters.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + } + + public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + if (isInCreateMode()) { + this.innerModel().withCatalogCollation(catalogCollation); + return this; + } else { + this.updateParameters.withCatalogCollation(catalogCollation); + return this; + } + } + + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.innerModel().withZoneRedundant(zoneRedundant); + return this; + } else { + this.updateParameters.withZoneRedundant(zoneRedundant); + return this; + } + } + + public DatabaseImpl withLicenseType(DatabaseLicenseType licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + public DatabaseImpl withReadScale(DatabaseReadScale readScale) { + if (isInCreateMode()) { + this.innerModel().withReadScale(readScale); + return this; + } else { + this.updateParameters.withReadScale(readScale); + return this; + } + } + + public DatabaseImpl withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (isInCreateMode()) { + this.innerModel().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } else { + this.updateParameters.withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + } + + public DatabaseImpl withSecondaryType(SecondaryType secondaryType) { + if (isInCreateMode()) { + this.innerModel().withSecondaryType(secondaryType); + return this; + } else { + this.updateParameters.withSecondaryType(secondaryType); + return this; + } + } + + public DatabaseImpl withAutoPauseDelay(Integer autoPauseDelay) { + if (isInCreateMode()) { + this.innerModel().withAutoPauseDelay(autoPauseDelay); + return this; + } else { + this.updateParameters.withAutoPauseDelay(autoPauseDelay); + return this; + } + } + + public DatabaseImpl withRequestedBackupStorageRedundancy( + RequestedBackupStorageRedundancy requestedBackupStorageRedundancy) { + if (isInCreateMode()) { + this.innerModel().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } else { + this.updateParameters.withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + } + + public DatabaseImpl withMinCapacity(Double minCapacity) { + if (isInCreateMode()) { + this.innerModel().withMinCapacity(minCapacity); + return this; + } else { + this.updateParameters.withMinCapacity(minCapacity); + return this; + } + } + + public DatabaseImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } else { + this.updateParameters.withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationImpl.java new file mode 100644 index 0000000000000..5c88983da58c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperation; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import java.time.OffsetDateTime; + +public final class DatabaseOperationImpl implements DatabaseOperation { + private DatabaseOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseOperationImpl( + DatabaseOperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public ManagementOperationState state() { + return this.innerModel().state(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public OffsetDateTime estimatedCompletionTime() { + return this.innerModel().estimatedCompletionTime(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public DatabaseOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java new file mode 100644 index 0000000000000..bccb006bbd5d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java @@ -0,0 +1,552 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.sql.generated.fluent.DatabaseOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperationListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseOperationsClient. */ +public final class DatabaseOperationsClientImpl implements DatabaseOperationsClient { + private final ClientLogger logger = new ClientLogger(DatabaseOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/operations/{operationId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> cancelWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, UUID operationId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @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> cancelWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, UUID operationId, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + return cancelWithResponseAsync(resourceGroupName, serverName, databaseName, operationId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + cancelAsync(resourceGroupName, serverName, databaseName, operationId).block(); + } + + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @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 cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context) { + return cancelWithResponseAsync(resourceGroupName, serverName, databaseName, operationId, context).block(); + } + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 operations performed on the database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 the response to a list database operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.java new file mode 100644 index 0000000000000..49556db0660b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperation; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class DatabaseOperationsImpl implements DatabaseOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseOperationsImpl.class); + + private final DatabaseOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseOperationsImpl( + DatabaseOperationsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + this.serviceClient().cancel(resourceGroupName, serverName, databaseName, operationId); + } + + public Response cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context) { + return this + .serviceClient() + .cancelWithResponse(resourceGroupName, serverName, databaseName, operationId, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseOperationImpl(inner1, this.manager())); + } + + private DatabaseOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..600518b83654a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyEmailAccountAdmins; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyUseServerDefault; + +public final class DatabaseSecurityAlertPolicyImpl + implements DatabaseSecurityAlertPolicy, DatabaseSecurityAlertPolicy.Definition, DatabaseSecurityAlertPolicy.Update { + private DatabaseSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 String kind() { + return this.innerModel().kind(); + } + + public SecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public String disabledAlerts() { + return this.innerModel().disabledAlerts(); + } + + public String emailAddresses() { + return this.innerModel().emailAddresses(); + } + + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.innerModel().useServerDefault(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DatabaseSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public DatabaseSecurityAlertPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DatabaseSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseThreatDetectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseThreatDetectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public DatabaseSecurityAlertPolicyImpl update() { + return this; + } + + public DatabaseSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseThreatDetectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseThreatDetectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseSecurityAlertPolicyImpl( + DatabaseSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public DatabaseSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseThreatDetectionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseThreatDetectionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withDisabledAlerts(String disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withEmailAddresses(String emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withEmailAccountAdmins( + SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.innerModel().withUseServerDefault(useServerDefault); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseThreatDetectionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseThreatDetectionPoliciesClientImpl.java new file mode 100644 index 0000000000000..d9f9b9609358f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseThreatDetectionPoliciesClientImpl.java @@ -0,0 +1,536 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.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.sql.generated.fluent.DatabaseThreatDetectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseThreatDetectionPoliciesClient. */ +public final class DatabaseThreatDetectionPoliciesClientImpl implements DatabaseThreatDetectionPoliciesClient { + private final ClientLogger logger = new ClientLogger(DatabaseThreatDetectionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseThreatDetectionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseThreatDetectionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseThreatDetectionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseThreatDetectionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseThreatDetectionPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseThreatDetectionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 database's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + apiVersion, + accept, + context); + } + + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName).block(); + } + + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 database's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context) + .block(); + } + + /** + * Creates or updates a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database Threat Detection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a database Threat Detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database Threat Detection policy. + * @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 contains information about a database Threat Detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database Threat Detection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a database Threat Detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database Threat Detection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a database Threat Detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters) + .block(); + } + + /** + * Creates or updates a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database Threat Detection policy. + * @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 contains information about a database Threat Detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseThreatDetectionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseThreatDetectionPoliciesImpl.java new file mode 100644 index 0000000000000..d905d17ffdc9e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseThreatDetectionPoliciesImpl.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.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseThreatDetectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.DatabaseThreatDetectionPolicies; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseThreatDetectionPoliciesImpl implements DatabaseThreatDetectionPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseThreatDetectionPoliciesImpl.class); + + private final DatabaseThreatDetectionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseThreatDetectionPoliciesImpl( + DatabaseThreatDetectionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseSecurityAlertPolicy get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + DatabaseSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, securityAlertPolicyName); + if (inner != null) { + return new DatabaseSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSecurityAlertPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context); + } + + private DatabaseThreatDetectionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new DatabaseSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.java new file mode 100644 index 0000000000000..787c8c819d520 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsage; +import java.time.OffsetDateTime; + +public final class DatabaseUsageImpl implements DatabaseUsage { + private DatabaseUsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseUsageImpl( + DatabaseUsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String resourceName() { + return this.innerModel().resourceName(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Double currentValue() { + return this.innerModel().currentValue(); + } + + public Double limit() { + return this.innerModel().limit(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public OffsetDateTime nextResetTime() { + return this.innerModel().nextResetTime(); + } + + public DatabaseUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.java new file mode 100644 index 0000000000000..646f9bff57595 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.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.sql.generated.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.sql.generated.fluent.DatabaseUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseUsagesClient. */ +public final class DatabaseUsagesClientImpl implements DatabaseUsagesClient { + private final ClientLogger logger = new ClientLogger(DatabaseUsagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseUsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseUsagesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseUsages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseUsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.java new file mode 100644 index 0000000000000..e9f0d3c454909 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.DatabaseUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsage; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseUsagesImpl implements DatabaseUsages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseUsagesImpl.class); + + private final DatabaseUsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseUsagesImpl( + DatabaseUsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseUsageImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseUsageImpl(inner1, this.manager())); + } + + private DatabaseUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..dcdcfa2dae28d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; + +public final class DatabaseVulnerabilityAssessmentImpl + implements DatabaseVulnerabilityAssessment, + DatabaseVulnerabilityAssessment.Definition, + DatabaseVulnerabilityAssessment.Update { + private DatabaseVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public String storageContainerSasKey() { + return this.innerModel().storageContainerSasKey(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerModel().recurringScans(); + } + + public DatabaseVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + public DatabaseVulnerabilityAssessmentImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DatabaseVulnerabilityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentImpl( + VulnerabilityAssessmentName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseVulnerabilityAssessmentInner(); + this.serviceManager = serviceManager; + this.vulnerabilityAssessmentName = name; + } + + public DatabaseVulnerabilityAssessmentImpl update() { + return this; + } + + public DatabaseVulnerabilityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentImpl( + DatabaseVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + } + + public DatabaseVulnerabilityAssessment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.innerModel().withStorageContainerPath(storageContainerPath); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.innerModel().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.innerModel().withRecurringScans(recurringScans); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..afdea0606210d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import java.util.Collections; +import java.util.List; + +public final class DatabaseVulnerabilityAssessmentRuleBaselineImpl + implements DatabaseVulnerabilityAssessmentRuleBaseline, + DatabaseVulnerabilityAssessmentRuleBaseline.Definition, + DatabaseVulnerabilityAssessmentRuleBaseline.Update { + private DatabaseVulnerabilityAssessmentRuleBaselineInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List baselineResults() { + List inner = this.innerModel().baselineResults(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DatabaseVulnerabilityAssessmentRuleBaselineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + private String ruleId; + + private VulnerabilityAssessmentPolicyBaselineName baselineName; + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withExistingRule( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.vulnerabilityAssessmentName = vulnerabilityAssessmentName; + this.ruleId = ruleId; + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl( + VulnerabilityAssessmentPolicyBaselineName name, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + this.serviceManager = serviceManager; + this.baselineName = name; + } + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl update() { + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl( + DatabaseVulnerabilityAssessmentRuleBaselineInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + this.ruleId = Utils.getValueFromIdByName(innerObject.id(), "rules"); + this.baselineName = + VulnerabilityAssessmentPolicyBaselineName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "baselines")); + } + + public DatabaseVulnerabilityAssessmentRuleBaseline refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withBaselineResults( + List baselineResults) { + this.innerModel().withBaselineResults(baselineResults); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java new file mode 100644 index 0000000000000..dbd4f76e0d944 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java @@ -0,0 +1,916 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.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.sql.generated.fluent.DatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl + implements DatabaseVulnerabilityAssessmentRuleBaselinesClient { + private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseVulnerabilityAssessmentRuleBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseVulnerabilityAssessmentRuleBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseVulnerabilityAssessmentRuleBaselines to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules" + + "/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules" + + "/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules" + + "/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .block(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, context) + .block(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters) + .block(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + context) + .block(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .block(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..871975682e72d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseVulnerabilityAssessmentRuleBaselinesImpl + implements DatabaseVulnerabilityAssessmentRuleBaselines { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselinesImpl.class); + + private final DatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseVulnerabilityAssessmentRuleBaselinesImpl( + DatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + } + + public DatabaseVulnerabilityAssessmentRuleBaseline 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); + if (baselineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + return this + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); + if (baselineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + return this + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); + if (baselineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + this + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); + if (baselineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + return this + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + } + + private DatabaseVulnerabilityAssessmentRuleBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl define(VulnerabilityAssessmentPolicyBaselineName name) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 0000000000000..c3837ae777d6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,1295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecordListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentScansClient. + */ +public final class DatabaseVulnerabilityAssessmentScansClientImpl + implements DatabaseVulnerabilityAssessmentScansClient { + private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentScansClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseVulnerabilityAssessmentScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseVulnerabilityAssessmentScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseVulnerabilityAssessmentScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseVulnerabilityAssessmentScans to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseVulnerabilityAssessmentScansService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + + "/{scanId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + + "/{scanId}/initiateScan") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> initiateScan( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + + "/{scanId}/export") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> export( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + 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 the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context)); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId).block(); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> initiateScanWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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>> initiateScanWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .getSyncPoller(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .getSyncPoller(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 initiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + initiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId).block(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + initiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId).block(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return exportWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java new file mode 100644 index 0000000000000..2f51060457cb9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScansExport; + +public final class DatabaseVulnerabilityAssessmentScansExportImpl + implements DatabaseVulnerabilityAssessmentScansExport { + private DatabaseVulnerabilityAssessmentScansExportInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseVulnerabilityAssessmentScansExportImpl( + DatabaseVulnerabilityAssessmentScansExportInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String exportedReportLocation() { + return this.innerModel().exportedReportLocation(); + } + + public DatabaseVulnerabilityAssessmentScansExportInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..02556536a1f7b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.DatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScansExport; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecord; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseVulnerabilityAssessmentScansImpl implements DatabaseVulnerabilityAssessmentScans { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentScansImpl.class); + + private final DatabaseVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseVulnerabilityAssessmentScansImpl( + DatabaseVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + VulnerabilityAssessmentScanRecordInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new VulnerabilityAssessmentScanRecordImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VulnerabilityAssessmentScanRecordImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + this + .serviceClient() + .initiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + } + + public void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + this + .serviceClient() + .initiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + } + + public DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + DatabaseVulnerabilityAssessmentScansExportInner inner = + this + .serviceClient() + .export(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .exportWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentScansExportImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DatabaseVulnerabilityAssessmentScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..3f5a533205607 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,1064 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.DatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DatabaseVulnerabilityAssessmentsClient. + */ +public final class DatabaseVulnerabilityAssessmentsClientImpl implements DatabaseVulnerabilityAssessmentsClient { + private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseVulnerabilityAssessments to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName).block(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, parameters) + .block(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName).block(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + 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 the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..de957a7aaf510 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.DatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseVulnerabilityAssessmentsImpl implements DatabaseVulnerabilityAssessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentsImpl.class); + + private final DatabaseVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseVulnerabilityAssessmentsImpl( + DatabaseVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + DatabaseVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public DatabaseVulnerabilityAssessment 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + this + .deleteWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this + .deleteWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + } + + private DatabaseVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseVulnerabilityAssessmentImpl define(VulnerabilityAssessmentName name) { + return new DatabaseVulnerabilityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java new file mode 100644 index 0000000000000..c18d822ccd0e3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,4167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseListResult; +import com.azure.resourcemanager.sql.generated.models.DatabaseUpdate; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.MetricDefinitionListResult; +import com.azure.resourcemanager.sql.generated.models.MetricListResult; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public final class DatabasesClientImpl implements DatabasesClient { + private final ClientLogger logger = new ClientLogger(DatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabases to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/export") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> export( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExportDatabaseDefinition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/pause") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> pause( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/resume") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resume( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("replicaType") ReplicaType replicaType, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/inaccessibleDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listInaccessibleByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> upgradeDataWarehouse( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/move") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> rename( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceMoveDefinition parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @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> listByElasticPoolNext( + @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> listInaccessibleByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, serverName, databaseName, filter)); + } + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, databaseName, filter, context)); + } + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, databaseName, filter)); + } + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, databaseName, filter, context)); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImportExportOperationResultInner> beginExportAsync( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + Mono>> mono = + exportWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + Context.NONE); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImportExportOperationResultInner> beginExportAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + exportWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + context); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + return exportAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + return exportAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, Context.NONE); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String databaseName) { + deleteAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, Context.NONE); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> pauseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .pause( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> pauseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .pause( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginPauseAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = pauseWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, Context.NONE); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginPauseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + pauseWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName) { + return beginPauseAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginPauseAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono pauseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginPauseAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName) { + return pauseAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName, Context context) { + return pauseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resumeWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .resume( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resumeWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .resume( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginResumeAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = resumeWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, Context.NONE); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginResumeAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + resumeWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginResume( + String resourceGroupName, String serverName, String databaseName) { + return beginResumeAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginResume( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginResumeAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resumeAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginResumeAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName) { + return resumeAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName, Context context) { + return resumeAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @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>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).getSyncPoller(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType, context).getSyncPoller(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 failoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 failoverAsync(String resourceGroupName, String serverName, String databaseName) { + final ReplicaType replicaType = null; + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @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 failoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 failover(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + failoverAsync(resourceGroupName, serverName, databaseName, replicaType).block(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 failover(String resourceGroupName, String serverName, String databaseName) { + final ReplicaType replicaType = null; + failoverAsync(resourceGroupName, serverName, databaseName, replicaType).block(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + failoverAsync(resourceGroupName, serverName, databaseName, replicaType, context).block(); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listInaccessibleByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInaccessibleByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listInaccessibleByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listInaccessibleByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listInaccessibleByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listInaccessibleByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listInaccessibleByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of inaccessible databases in a logical server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listInaccessibleByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> upgradeDataWarehouseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .upgradeDataWarehouse( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @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>> upgradeDataWarehouseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .upgradeDataWarehouse( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginUpgradeDataWarehouseAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = + upgradeDataWarehouseWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginUpgradeDataWarehouseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + upgradeDataWarehouseWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @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 upgradeDataWarehouseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void upgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context) { + upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> renameWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .rename( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @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> renameWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .rename( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 renameAsync( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters) { + return renameWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 rename( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters) { + renameAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @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 renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context) { + return renameWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(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 databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync(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 + .listByElasticPoolNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerNextSinglePageAsync(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.listInaccessibleByServerNext(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 databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerNextSinglePageAsync( + 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 + .listInaccessibleByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..1a07f8a749771 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.Databases; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.Metric; +import com.azure.resourcemanager.sql.generated.models.MetricDefinition; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabasesImpl implements Databases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabasesImpl.class); + + private final DatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabasesImpl( + DatabasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, databaseName, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public ImportExportOperationResult export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + ImportExportOperationResultInner inner = + this.serviceClient().export(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ImportExportOperationResult export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + ImportExportOperationResultInner inner = + this.serviceClient().export(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public Database get(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName); + } + + public void delete(String resourceGroupName, String serverName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, context); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public Database pause(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().pause(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Database pause(String resourceGroupName, String serverName, String databaseName, Context context) { + DatabaseInner inner = this.serviceClient().pause(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Database resume(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().resume(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Database resume(String resourceGroupName, String serverName, String databaseName, Context context) { + DatabaseInner inner = this.serviceClient().resume(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public void failover(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + this.serviceClient().failover(resourceGroupName, serverName, databaseName, replicaType); + } + + public void failover(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().failover(resourceGroupName, serverName, databaseName); + } + + public void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + this.serviceClient().failover(resourceGroupName, serverName, databaseName, replicaType, context); + } + + public PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listInaccessibleByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listInaccessibleByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listInaccessibleByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().upgradeDataWarehouse(resourceGroupName, serverName, databaseName); + } + + public void upgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context) { + this.serviceClient().upgradeDataWarehouse(resourceGroupName, serverName, databaseName, context); + } + + public void rename( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters) { + this.serviceClient().rename(resourceGroupName, serverName, databaseName, parameters); + } + + public Response renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context) { + return this + .serviceClient() + .renameWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + public Database 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, context); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseImpl define(String name) { + return new DatabaseImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.java new file mode 100644 index 0000000000000..f760569f15351 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ElasticPoolActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivityListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolActivitiesClient. */ +public final class ElasticPoolActivitiesClientImpl implements ElasticPoolActivitiesClient { + private final ClientLogger logger = new ClientLogger(ElasticPoolActivitiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ElasticPoolActivitiesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolActivitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolActivitiesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ElasticPoolActivitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPoolActivities to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface ElasticPoolActivitiesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @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 represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>(() -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @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 represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @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 represents the response to a list elastic pool activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.java new file mode 100644 index 0000000000000..6e94df977f729 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ElasticPoolActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivity; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ElasticPoolActivitiesImpl implements ElasticPoolActivities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolActivitiesImpl.class); + + private final ElasticPoolActivitiesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolActivitiesImpl( + ElasticPoolActivitiesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolActivityImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolActivityImpl(inner1, this.manager())); + } + + private ElasticPoolActivitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivityImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivityImpl.java new file mode 100644 index 0000000000000..97f430e16764a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivityImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivity; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class ElasticPoolActivityImpl implements ElasticPoolActivity { + private ElasticPoolActivityInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ElasticPoolActivityImpl( + ElasticPoolActivityInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public UUID operationId() { + return this.innerModel().operationId(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public Integer requestedDatabaseDtuMax() { + return this.innerModel().requestedDatabaseDtuMax(); + } + + public Integer requestedDatabaseDtuMin() { + return this.innerModel().requestedDatabaseDtuMin(); + } + + public Integer requestedDtu() { + return this.innerModel().requestedDtu(); + } + + public String requestedElasticPoolName() { + return this.innerModel().requestedElasticPoolName(); + } + + public Long requestedStorageLimitInGB() { + return this.innerModel().requestedStorageLimitInGB(); + } + + public String elasticPoolName() { + return this.innerModel().elasticPoolName(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String state() { + return this.innerModel().state(); + } + + public Integer requestedStorageLimitInMB() { + return this.innerModel().requestedStorageLimitInMB(); + } + + public Integer requestedDatabaseDtuGuarantee() { + return this.innerModel().requestedDatabaseDtuGuarantee(); + } + + public Integer requestedDatabaseDtuCap() { + return this.innerModel().requestedDatabaseDtuCap(); + } + + public Integer requestedDtuGuarantee() { + return this.innerModel().requestedDtuGuarantee(); + } + + public ElasticPoolActivityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.java new file mode 100644 index 0000000000000..e105f0d91a197 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ElasticPoolDatabaseActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivityListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolDatabaseActivitiesClient. */ +public final class ElasticPoolDatabaseActivitiesClientImpl implements ElasticPoolDatabaseActivitiesClient { + private final ClientLogger logger = new ClientLogger(ElasticPoolDatabaseActivitiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ElasticPoolDatabaseActivitiesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolDatabaseActivitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolDatabaseActivitiesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ElasticPoolDatabaseActivitiesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPoolDatabaseActivities to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface ElasticPoolDatabaseActivitiesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>(() -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.java new file mode 100644 index 0000000000000..ab47dadae0ae3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ElasticPoolDatabaseActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivity; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ElasticPoolDatabaseActivitiesImpl implements ElasticPoolDatabaseActivities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolDatabaseActivitiesImpl.class); + + private final ElasticPoolDatabaseActivitiesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolDatabaseActivitiesImpl( + ElasticPoolDatabaseActivitiesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolDatabaseActivityImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolDatabaseActivityImpl(inner1, this.manager())); + } + + private ElasticPoolDatabaseActivitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivityImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivityImpl.java new file mode 100644 index 0000000000000..2a9044e2ea808 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivityImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivity; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class ElasticPoolDatabaseActivityImpl implements ElasticPoolDatabaseActivity { + private ElasticPoolDatabaseActivityInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ElasticPoolDatabaseActivityImpl( + ElasticPoolDatabaseActivityInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public UUID operationId() { + return this.innerModel().operationId(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public String requestedElasticPoolName() { + return this.innerModel().requestedElasticPoolName(); + } + + public String currentElasticPoolName() { + return this.innerModel().currentElasticPoolName(); + } + + public String currentServiceObjective() { + return this.innerModel().currentServiceObjective(); + } + + public String requestedServiceObjective() { + return this.innerModel().requestedServiceObjective(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String state() { + return this.innerModel().state(); + } + + public ElasticPoolDatabaseActivityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java new file mode 100644 index 0000000000000..2c320aa91b484 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPool; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolState; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolUpdate; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ElasticPoolImpl implements ElasticPool, ElasticPool.Definition, ElasticPool.Update { + private ElasticPoolInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ElasticPoolState state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public Long maxSizeBytes() { + return this.innerModel().maxSizeBytes(); + } + + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.innerModel().perDatabaseSettings(); + } + + public Boolean zoneRedundant() { + return this.innerModel().zoneRedundant(); + } + + public ElasticPoolLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public String maintenanceConfigurationId() { + return this.innerModel().maintenanceConfigurationId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ElasticPoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String elasticPoolName; + + private ElasticPoolUpdate updateParameters; + + public ElasticPoolImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ElasticPool create() { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .createOrUpdate(resourceGroupName, serverName, elasticPoolName, this.innerModel(), Context.NONE); + return this; + } + + public ElasticPool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .createOrUpdate(resourceGroupName, serverName, elasticPoolName, this.innerModel(), context); + return this; + } + + ElasticPoolImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ElasticPoolInner(); + this.serviceManager = serviceManager; + this.elasticPoolName = name; + } + + public ElasticPoolImpl update() { + this.updateParameters = new ElasticPoolUpdate(); + return this; + } + + public ElasticPool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .update(resourceGroupName, serverName, elasticPoolName, updateParameters, Context.NONE); + return this; + } + + public ElasticPool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .update(resourceGroupName, serverName, elasticPoolName, updateParameters, context); + return this; + } + + ElasticPoolImpl(ElasticPoolInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.elasticPoolName = Utils.getValueFromIdByName(innerObject.id(), "elasticPools"); + } + + public ElasticPool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .getWithResponse(resourceGroupName, serverName, elasticPoolName, Context.NONE) + .getValue(); + return this; + } + + public ElasticPool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .getWithResponse(resourceGroupName, serverName, elasticPoolName, context) + .getValue(); + return this; + } + + public ElasticPoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ElasticPoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ElasticPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ElasticPoolImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public ElasticPoolImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.innerModel().withMaxSizeBytes(maxSizeBytes); + return this; + } else { + this.updateParameters.withMaxSizeBytes(maxSizeBytes); + return this; + } + } + + public ElasticPoolImpl withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + if (isInCreateMode()) { + this.innerModel().withPerDatabaseSettings(perDatabaseSettings); + return this; + } else { + this.updateParameters.withPerDatabaseSettings(perDatabaseSettings); + return this; + } + } + + public ElasticPoolImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.innerModel().withZoneRedundant(zoneRedundant); + return this; + } else { + this.updateParameters.withZoneRedundant(zoneRedundant); + return this; + } + } + + public ElasticPoolImpl withLicenseType(ElasticPoolLicenseType licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + public ElasticPoolImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } else { + this.updateParameters.withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationImpl.java new file mode 100644 index 0000000000000..f0cdd15fcfefa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperation; +import java.time.OffsetDateTime; + +public final class ElasticPoolOperationImpl implements ElasticPoolOperation { + private ElasticPoolOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ElasticPoolOperationImpl( + ElasticPoolOperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String elasticPoolName() { + return this.innerModel().elasticPoolName(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String state() { + return this.innerModel().state(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public OffsetDateTime estimatedCompletionTime() { + return this.innerModel().estimatedCompletionTime(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public ElasticPoolOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java new file mode 100644 index 0000000000000..975a1d984b799 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.sql.generated.fluent.ElasticPoolOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperationListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolOperationsClient. */ +public final class ElasticPoolOperationsClientImpl implements ElasticPoolOperationsClient { + private final ClientLogger logger = new ClientLogger(ElasticPoolOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ElasticPoolOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ElasticPoolOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPoolOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface ElasticPoolOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @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> listByElasticPoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> cancelWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @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> cancelWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cancelAsync( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + return cancelWithResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + cancelAsync(resourceGroupName, serverName, elasticPoolName, operationId).block(); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @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 cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context) { + return cancelWithResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId, context).block(); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName 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 operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName 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 operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName 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 operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName 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 operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName 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 operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName 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 operations performed on the elastic pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, 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 the response to a list elastic pool operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list elastic pool operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync( + 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 + .listByElasticPoolNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.java new file mode 100644 index 0000000000000..0f2008c9e877e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperation; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class ElasticPoolOperationsImpl implements ElasticPoolOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolOperationsImpl.class); + + private final ElasticPoolOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolOperationsImpl( + ElasticPoolOperationsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + this.serviceClient().cancel(resourceGroupName, serverName, elasticPoolName, operationId); + } + + public Response cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context) { + return this + .serviceClient() + .cancelWithResponse(resourceGroupName, serverName, elasticPoolName, operationId, context); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolOperationImpl(inner1, this.manager())); + } + + private ElasticPoolOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java new file mode 100644 index 0000000000000..68f5918a302d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java @@ -0,0 +1,2229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolListResult; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolUpdate; +import com.azure.resourcemanager.sql.generated.models.MetricDefinitionListResult; +import com.azure.resourcemanager.sql.generated.models.MetricListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolsClient. */ +public final class ElasticPoolsClientImpl implements ElasticPoolsClient { + private final ClientLogger logger = new ClientLogger(ElasticPoolsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ElasticPoolsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ElasticPoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPools to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface ElasticPoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @QueryParam("$skip") Integer skip, + @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.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @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.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ElasticPoolInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ElasticPoolUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, elasticPoolName, filter)); + } + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, elasticPoolName, filter, context)); + } + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, elasticPoolName, filter)); + } + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, elasticPoolName, filter, context)); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Integer skip) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skip, + this.client.getSubscriptionId(), + apiVersion, + 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 elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @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 elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Integer skip, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skip, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Integer skip) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skip), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + final Integer skip = null; + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skip), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @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 elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Integer skip, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skip, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + final Integer skip = null; + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skip)); + } + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @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 elastic pools in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Integer skip, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skip, context)); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithResponseAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName) { + return getAsync(resourceGroupName, serverName, elasticPoolName).block(); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, elasticPoolName, context).block(); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName 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 apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName 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 apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ElasticPoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ElasticPoolInner.class, ElasticPoolInner.class, Context.NONE); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ElasticPoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ElasticPoolInner.class, ElasticPoolInner.class, context); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner createOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters).block(); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner createOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context).block(); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, elasticPoolName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, elasticPoolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String elasticPoolName) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName).getSyncPoller(); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName, context).getSyncPoller(); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String elasticPoolName) { + deleteAsync(resourceGroupName, serverName, elasticPoolName).block(); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + deleteAsync(resourceGroupName, serverName, elasticPoolName, context).block(); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName 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 apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName 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 apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ElasticPoolInner> beginUpdateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ElasticPoolInner.class, ElasticPoolInner.class, Context.NONE); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ElasticPoolInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ElasticPoolInner.class, ElasticPoolInner.class, context); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters).getSyncPoller(); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context).getSyncPoller(); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner update( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateAsync(resourceGroupName, serverName, elasticPoolName, parameters).block(); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner update( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context).block(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @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>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, elasticPoolName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, elasticPoolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName).getSyncPoller(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName, context).getSyncPoller(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 failoverAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @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 failoverAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 failover(String resourceGroupName, String serverName, String elasticPoolName) { + failoverAsync(resourceGroupName, serverName, elasticPoolName).block(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + failoverAsync(resourceGroupName, serverName, elasticPoolName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of an elastic pool list request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of an elastic pool list request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..76982d6a3d151 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPool; +import com.azure.resourcemanager.sql.generated.models.ElasticPools; +import com.azure.resourcemanager.sql.generated.models.Metric; +import com.azure.resourcemanager.sql.generated.models.MetricDefinition; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ElasticPoolsImpl implements ElasticPools { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolsImpl.class); + + private final ElasticPoolsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolsImpl( + ElasticPoolsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, elasticPoolName, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, elasticPoolName, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Integer skip, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, skip, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolImpl(inner1, this.manager())); + } + + public ElasticPool get(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolInner inner = this.serviceClient().get(resourceGroupName, serverName, elasticPoolName); + if (inner != null) { + return new ElasticPoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, elasticPoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ElasticPoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String elasticPoolName) { + this.serviceClient().delete(resourceGroupName, serverName, elasticPoolName); + } + + public void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, elasticPoolName, context); + } + + public void failover(String resourceGroupName, String serverName, String elasticPoolName) { + this.serviceClient().failover(resourceGroupName, serverName, elasticPoolName); + } + + public void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + this.serviceClient().failover(resourceGroupName, serverName, elasticPoolName, context); + } + + public ElasticPool 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, elasticPoolName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, elasticPoolName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + this.delete(resourceGroupName, serverName, elasticPoolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + this.delete(resourceGroupName, serverName, elasticPoolName, context); + } + + private ElasticPoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ElasticPoolImpl define(String name) { + return new ElasticPoolImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.java new file mode 100644 index 0000000000000..e554e2a1b412e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.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.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +public final class EncryptionProtectorImpl + implements EncryptionProtector, EncryptionProtector.Definition, EncryptionProtector.Update { + private EncryptionProtectorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public String subregion() { + return this.innerModel().subregion(); + } + + public String serverKeyName() { + return this.innerModel().serverKeyName(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public EncryptionProtectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private EncryptionProtectorName encryptionProtectorName; + + public EncryptionProtectorImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public EncryptionProtector create() { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate( + resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public EncryptionProtector create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate(resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + EncryptionProtectorImpl( + EncryptionProtectorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new EncryptionProtectorInner(); + this.serviceManager = serviceManager; + this.encryptionProtectorName = name; + } + + public EncryptionProtectorImpl update() { + return this; + } + + public EncryptionProtector apply() { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate( + resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public EncryptionProtector apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate(resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + EncryptionProtectorImpl( + EncryptionProtectorInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "encryptionProtector")); + } + + public EncryptionProtector refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .getWithResponse(resourceGroupName, serverName, encryptionProtectorName, Context.NONE) + .getValue(); + return this; + } + + public EncryptionProtector refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .getWithResponse(resourceGroupName, serverName, encryptionProtectorName, context) + .getValue(); + return this; + } + + public EncryptionProtectorImpl withServerKeyName(String serverKeyName) { + this.innerModel().withServerKeyName(serverKeyName); + return this; + } + + public EncryptionProtectorImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java new file mode 100644 index 0000000000000..2b3bb85483818 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java @@ -0,0 +1,1190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.EncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorListResult; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EncryptionProtectorsClient. */ +public final class EncryptionProtectorsClientImpl implements EncryptionProtectorsClient { + private final ClientLogger logger = new ClientLogger(EncryptionProtectorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final EncryptionProtectorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of EncryptionProtectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EncryptionProtectorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(EncryptionProtectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientEncryptionProtectors to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface EncryptionProtectorsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> revalidate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/encryptionProtector") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.Sql/servers" + + "/{serverName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @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.Sql/servers" + + "/{serverName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EncryptionProtectorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + context = this.client.mergeContext(context); + return service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName).getSyncPoller(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName, context).getSyncPoller(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + revalidateAsync(resourceGroupName, serverName, encryptionProtectorName).block(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + revalidateAsync(resourceGroupName, serverName, encryptionProtectorName, context).block(); + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return getWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EncryptionProtectorInner get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return getAsync(resourceGroupName, serverName, encryptionProtectorName).block(); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName, context).block(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, EncryptionProtectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + EncryptionProtectorInner.class, + EncryptionProtectorInner.class, + Context.NONE); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, EncryptionProtectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, encryptionProtectorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + EncryptionProtectorInner.class, + EncryptionProtectorInner.class, + context); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters) + .getSyncPoller(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters).block(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 server encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..3c7eac007d95d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.EncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectors; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EncryptionProtectorsImpl implements EncryptionProtectors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionProtectorsImpl.class); + + private final EncryptionProtectorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public EncryptionProtectorsImpl( + EncryptionProtectorsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + this.serviceClient().revalidate(resourceGroupName, serverName, encryptionProtectorName); + } + + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + this.serviceClient().revalidate(resourceGroupName, serverName, encryptionProtectorName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new EncryptionProtectorImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new EncryptionProtectorImpl(inner1, this.manager())); + } + + public EncryptionProtector get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + EncryptionProtectorInner inner = + this.serviceClient().get(resourceGroupName, serverName, encryptionProtectorName); + if (inner != null) { + return new EncryptionProtectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, encryptionProtectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EncryptionProtectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EncryptionProtector 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(id, "encryptionProtector")); + if (encryptionProtectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, encryptionProtectorName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(id, "encryptionProtector")); + if (encryptionProtectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, encryptionProtectorName, context); + } + + private EncryptionProtectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public EncryptionProtectorImpl define(EncryptionProtectorName name) { + return new EncryptionProtectorImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..1355220d9cc75 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,795 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.sql.generated.fluent.ExtendedDatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicyListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ExtendedDatabaseBlobAuditingPoliciesClient. + */ +public final class ExtendedDatabaseBlobAuditingPoliciesClientImpl + implements ExtendedDatabaseBlobAuditingPoliciesClient { + private final ClientLogger logger = new ClientLogger(ExtendedDatabaseBlobAuditingPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ExtendedDatabaseBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedDatabaseBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendedDatabaseBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ExtendedDatabaseBlobAuditingPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientExtendedDatabaseBlobAuditingPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface ExtendedDatabaseBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExtendedDatabaseBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extendedAuditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedDatabaseBlobAuditingPolicyInner get( + String resourceGroupName, String serverName, String databaseName) { + return getAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Creates or updates an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The extended database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The extended database blob auditing policy. + * @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 an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The extended database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The extended database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedDatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Creates or updates an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The extended database blob auditing policy. + * @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 an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context) + .block(); + } + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + 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 extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 database extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..77c76bf7687eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ExtendedDatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ExtendedDatabaseBlobAuditingPoliciesImpl implements ExtendedDatabaseBlobAuditingPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedDatabaseBlobAuditingPoliciesImpl.class); + + private final ExtendedDatabaseBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ExtendedDatabaseBlobAuditingPoliciesImpl( + ExtendedDatabaseBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ExtendedDatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName) { + ExtendedDatabaseBlobAuditingPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new ExtendedDatabaseBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExtendedDatabaseBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new ExtendedDatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ExtendedDatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public ExtendedDatabaseBlobAuditingPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, context); + } + + private ExtendedDatabaseBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl define() { + return new ExtendedDatabaseBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..13da299d04bc0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ExtendedDatabaseBlobAuditingPolicyImpl + implements ExtendedDatabaseBlobAuditingPolicy, + ExtendedDatabaseBlobAuditingPolicy.Definition, + ExtendedDatabaseBlobAuditingPolicy.Update { + private ExtendedDatabaseBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String predicateExpression() { + return this.innerModel().predicateExpression(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public ExtendedDatabaseBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public ExtendedDatabaseBlobAuditingPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + ExtendedDatabaseBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ExtendedDatabaseBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl update() { + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + ExtendedDatabaseBlobAuditingPolicyImpl( + ExtendedDatabaseBlobAuditingPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public ExtendedDatabaseBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.innerModel().withPredicateExpression(predicateExpression); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..d45e9d00ed4e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,862 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendedServerBlobAuditingPoliciesClient. + */ +public final class ExtendedServerBlobAuditingPoliciesClientImpl implements ExtendedServerBlobAuditingPoliciesClient { + private final ClientLogger logger = new ClientLogger(ExtendedServerBlobAuditingPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ExtendedServerBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedServerBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendedServerBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ExtendedServerBlobAuditingPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientExtendedServerBlobAuditingPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface ExtendedServerBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @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.Sql/servers" + + "/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExtendedServerBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/extendedAuditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).block(); + } + + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExtendedServerBlobAuditingPolicyInner.class, + ExtendedServerBlobAuditingPolicyInner.class, + Context.NONE); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExtendedServerBlobAuditingPolicyInner.class, + ExtendedServerBlobAuditingPolicyInner.class, + context); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Creates or updates an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of extended blob auditing policy. + * @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 an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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.listByServerNext(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 server extended auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..e2aebbb39e1c8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ExtendedServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ExtendedServerBlobAuditingPoliciesImpl implements ExtendedServerBlobAuditingPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedServerBlobAuditingPoliciesImpl.class); + + private final ExtendedServerBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ExtendedServerBlobAuditingPoliciesImpl( + ExtendedServerBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ExtendedServerBlobAuditingPolicy get(String resourceGroupName, String serverName) { + ExtendedServerBlobAuditingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ExtendedServerBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExtendedServerBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ExtendedServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ExtendedServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public ExtendedServerBlobAuditingPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, context); + } + + private ExtendedServerBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ExtendedServerBlobAuditingPolicyImpl define() { + return new ExtendedServerBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..1bb0a19cf2121 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ExtendedServerBlobAuditingPolicyImpl + implements ExtendedServerBlobAuditingPolicy, + ExtendedServerBlobAuditingPolicy.Definition, + ExtendedServerBlobAuditingPolicy.Update { + private ExtendedServerBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String predicateExpression() { + return this.innerModel().predicateExpression(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public ExtendedServerBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + public ExtendedServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ExtendedServerBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ExtendedServerBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ExtendedServerBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ExtendedServerBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public ExtendedServerBlobAuditingPolicyImpl update() { + return this; + } + + public ExtendedServerBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ExtendedServerBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ExtendedServerBlobAuditingPolicyImpl( + ExtendedServerBlobAuditingPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + } + + public ExtendedServerBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, Context.NONE) + .getValue(); + return this; + } + + public ExtendedServerBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, context) + .getValue(); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.innerModel().withPredicateExpression(predicateExpression); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java new file mode 100644 index 0000000000000..94cde02b2d25c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupUpdate; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class FailoverGroupImpl implements FailoverGroup, FailoverGroup.Definition, FailoverGroup.Update { + private FailoverGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerModel().readWriteEndpoint(); + } + + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerModel().readOnlyEndpoint(); + } + + public FailoverGroupReplicationRole replicationRole() { + return this.innerModel().replicationRole(); + } + + public String replicationState() { + return this.innerModel().replicationState(); + } + + public List partnerServers() { + List inner = this.innerModel().partnerServers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List databases() { + List inner = this.innerModel().databases(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public FailoverGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String failoverGroupName; + + private FailoverGroupUpdate updateParameters; + + public FailoverGroupImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public FailoverGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .createOrUpdate(resourceGroupName, serverName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public FailoverGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .createOrUpdate(resourceGroupName, serverName, failoverGroupName, this.innerModel(), context); + return this; + } + + FailoverGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new FailoverGroupInner(); + this.serviceManager = serviceManager; + this.failoverGroupName = name; + } + + public FailoverGroupImpl update() { + this.updateParameters = new FailoverGroupUpdate(); + return this; + } + + public FailoverGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .update(resourceGroupName, serverName, failoverGroupName, updateParameters, Context.NONE); + return this; + } + + public FailoverGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .update(resourceGroupName, serverName, failoverGroupName, updateParameters, context); + return this; + } + + FailoverGroupImpl( + FailoverGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.failoverGroupName = Utils.getValueFromIdByName(innerObject.id(), "failoverGroups"); + } + + public FailoverGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, serverName, failoverGroupName, Context.NONE) + .getValue(); + return this; + } + + public FailoverGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, serverName, failoverGroupName, context) + .getValue(); + return this; + } + + public FailoverGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public FailoverGroupImpl withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + if (isInCreateMode()) { + this.innerModel().withReadWriteEndpoint(readWriteEndpoint); + return this; + } else { + this.updateParameters.withReadWriteEndpoint(readWriteEndpoint); + return this; + } + } + + public FailoverGroupImpl withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + if (isInCreateMode()) { + this.innerModel().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } else { + this.updateParameters.withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + } + + public FailoverGroupImpl withPartnerServers(List partnerServers) { + this.innerModel().withPartnerServers(partnerServers); + return this; + } + + public FailoverGroupImpl withDatabases(List databases) { + if (isInCreateMode()) { + this.innerModel().withDatabases(databases); + return this; + } else { + this.updateParameters.withDatabases(databases); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java new file mode 100644 index 0000000000000..02d622a21995a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java @@ -0,0 +1,2064 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupListResult; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FailoverGroupsClient. */ +public final class FailoverGroupsClientImpl implements FailoverGroupsClient { + private final ClientLogger logger = new ClientLogger(FailoverGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FailoverGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of FailoverGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FailoverGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(FailoverGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientFailoverGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientF") + private interface FailoverGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @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.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverGroupUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> forceFailoverAllowDataLoss( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, failoverGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner get(String resourceGroupName, String serverName, String failoverGroupName) { + return getAsync(resourceGroupName, serverName, failoverGroupName).block(); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, Context.NONE); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner createOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters).block(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context).block(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, failoverGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName).getSyncPoller(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName, context).getSyncPoller(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String failoverGroupName) { + deleteAsync(resourceGroupName, serverName, failoverGroupName).block(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context) { + deleteAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginUpdateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, Context.NONE); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters).getSyncPoller(); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context).getSyncPoller(); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner update( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return updateAsync(resourceGroupName, serverName, failoverGroupName, parameters).block(); + } + + /** + * Updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner update( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context).block(); + } + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, failoverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, Context.NONE); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName).getSyncPoller(); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName, context).getSyncPoller(); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName) { + return failoverAsync(resourceGroupName, serverName, failoverGroupName).block(); + } + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner failover( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return failoverAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginForceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, failoverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, Context.NONE); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FailoverGroupInner> beginForceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName).getSyncPoller(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName, context) + .getSyncPoller(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName) { + return forceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName).block(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return forceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java new file mode 100644 index 0000000000000..454891aff3bf4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FailoverGroupsImpl implements FailoverGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverGroupsImpl.class); + + private final FailoverGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public FailoverGroupsImpl( + FailoverGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public FailoverGroup get(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupInner inner = this.serviceClient().get(resourceGroupName, serverName, failoverGroupName); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, failoverGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FailoverGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String failoverGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, failoverGroupName); + } + + public void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, failoverGroupName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new FailoverGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new FailoverGroupImpl(inner1, this.manager())); + } + + public FailoverGroup failover(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupInner inner = this.serviceClient().failover(resourceGroupName, serverName, failoverGroupName); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup failover( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + FailoverGroupInner inner = + this.serviceClient().failover(resourceGroupName, serverName, failoverGroupName, context); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupInner inner = + this.serviceClient().forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + FailoverGroupInner inner = + this.serviceClient().forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, context); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, failoverGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, failoverGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, serverName, failoverGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, serverName, failoverGroupName, context); + } + + private FailoverGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public FailoverGroupImpl define(String name) { + return new FailoverGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..4432171555877 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public String startIpAddress() { + return this.innerModel().startIpAddress(); + } + + public String endIpAddress() { + return this.innerModel().endIpAddress(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + FirewallRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public FirewallRuleImpl update() { + return this; + } + + public FirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + FirewallRuleImpl(FirewallRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, context) + .getValue(); + return this; + } + + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.innerModel().withStartIpAddress(startIpAddress); + return this; + } + + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.innerModel().withEndIpAddress(endIpAddress); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java new file mode 100644 index 0000000000000..544ea916c7acb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,830 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +public final class FirewallRulesClientImpl implements FirewallRulesClient { + private final ClientLogger logger = new ClientLogger(FirewallRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FirewallRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientFirewallRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientF") + private interface FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @BodyParam("application/json") FirewallRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + parameters, + accept, + context); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).block(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .block(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 serverName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + context); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String firewallRuleName) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String firewallRuleName) { + deleteAsync(resourceGroupName, serverName, firewallRuleName).block(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 serverName, String firewallRuleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getAsync(resourceGroupName, serverName, firewallRuleName).block(); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..fec85de187ba9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; +import com.azure.resourcemanager.sql.generated.models.FirewallRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FirewallRulesImpl implements FirewallRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRulesImpl.class); + + private final FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public FirewallRulesImpl( + FirewallRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName); + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + public FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public FirewallRule 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + private FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.java new file mode 100644 index 0000000000000..41fe6060368ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.java @@ -0,0 +1,730 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.sql.generated.fluent.GeoBackupPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GeoBackupPoliciesClient. */ +public final class GeoBackupPoliciesClientImpl implements GeoBackupPoliciesClient { + private final ClientLogger logger = new ClientLogger(GeoBackupPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GeoBackupPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of GeoBackupPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GeoBackupPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(GeoBackupPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientGeoBackupPolicies to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientG") + private interface GeoBackupPoliciesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("geoBackupPolicyName") GeoBackupPolicyName geoBackupPolicyName, + @BodyParam("application/json") GeoBackupPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("geoBackupPolicyName") GeoBackupPolicyName geoBackupPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/geoBackupPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Updates a database geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a database geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @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 database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + parameters, + accept, + context); + } + + /** + * Updates a database geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a database geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GeoBackupPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, geoBackupPolicyName, parameters) + .block(); + } + + /** + * Updates a database geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @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 database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, parameters, context) + .block(); + } + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @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 geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + accept, + context); + } + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, geoBackupPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GeoBackupPolicyInner get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + return getAsync(resourceGroupName, serverName, databaseName, geoBackupPolicyName).block(); + } + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @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 geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context).block(); + } + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list geo backup policies request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.java new file mode 100644 index 0000000000000..e807ebde8401a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.GeoBackupPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicies; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GeoBackupPoliciesImpl implements GeoBackupPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GeoBackupPoliciesImpl.class); + + private final GeoBackupPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public GeoBackupPoliciesImpl( + GeoBackupPoliciesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GeoBackupPolicy get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + GeoBackupPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, geoBackupPolicyName); + if (inner != null) { + return new GeoBackupPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GeoBackupPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new GeoBackupPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new GeoBackupPolicyImpl(inner1, this.manager())); + } + + public GeoBackupPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + GeoBackupPolicyName geoBackupPolicyName = + GeoBackupPolicyName.fromString(Utils.getValueFromIdByName(id, "geoBackupPolicies")); + if (geoBackupPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'geoBackupPolicies'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + GeoBackupPolicyName geoBackupPolicyName = + GeoBackupPolicyName.fromString(Utils.getValueFromIdByName(id, "geoBackupPolicies")); + if (geoBackupPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'geoBackupPolicies'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context); + } + + private GeoBackupPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public GeoBackupPolicyImpl define(GeoBackupPolicyName name) { + return new GeoBackupPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPolicyImpl.java new file mode 100644 index 0000000000000..13ccecf9e3d3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPolicyImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; + +public final class GeoBackupPolicyImpl implements GeoBackupPolicy, GeoBackupPolicy.Definition, GeoBackupPolicy.Update { + private GeoBackupPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public GeoBackupPolicyState state() { + return this.innerModel().state(); + } + + public String storageType() { + return this.innerModel().storageType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GeoBackupPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private GeoBackupPolicyName geoBackupPolicyName; + + public GeoBackupPolicyImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public GeoBackupPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GeoBackupPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + GeoBackupPolicyImpl(GeoBackupPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new GeoBackupPolicyInner(); + this.serviceManager = serviceManager; + this.geoBackupPolicyName = name; + } + + public GeoBackupPolicyImpl update() { + return this; + } + + public GeoBackupPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GeoBackupPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + GeoBackupPolicyImpl( + GeoBackupPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.geoBackupPolicyName = + GeoBackupPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "geoBackupPolicies")); + } + + public GeoBackupPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, Context.NONE) + .getValue(); + return this; + } + + public GeoBackupPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context) + .getValue(); + return this; + } + + public GeoBackupPolicyImpl withState(GeoBackupPolicyState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportOperationResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportOperationResultImpl.java new file mode 100644 index 0000000000000..5e0a99c810d7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportOperationResultImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionRequestStatus; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ImportExportOperationResultImpl implements ImportExportOperationResult { + private ImportExportOperationResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ImportExportOperationResultImpl( + ImportExportOperationResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public UUID requestId() { + return this.innerModel().requestId(); + } + + public String requestType() { + return this.innerModel().requestType(); + } + + public String queuedTime() { + return this.innerModel().queuedTime(); + } + + public String lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public String blobUri() { + return this.innerModel().blobUri(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String status() { + return this.innerModel().status(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ImportExportOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportsClientImpl.java new file mode 100644 index 0000000000000..8ee569e0f31b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportsClientImpl.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ImportExportsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ImportExportsClient. */ +public final class ImportExportsClientImpl implements ImportExportsClient { + private final ClientLogger logger = new ClientLogger(ImportExportsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ImportExportsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ImportExportsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImportExportsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ImportExportsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientImportExports to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientI") + private interface ImportExportsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/import") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> importMethod( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ImportExistingDatabaseDefinition parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importMethodWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .importMethod( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importMethodWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .importMethod( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImportExportOperationResultInner> + beginImportMethodAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters) { + Mono>> mono = + importMethodWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + Context.NONE); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImportExportOperationResultInner> + beginImportMethodAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + importMethodWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + context); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importMethodAsync( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importMethodAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + return importMethodAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + return importMethodAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportsImpl.java new file mode 100644 index 0000000000000..53e5968b4c7ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ImportExportsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.ImportExports; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ImportExportsImpl implements ImportExports { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImportExportsImpl.class); + + private final ImportExportsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ImportExportsImpl( + ImportExportsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ImportExportOperationResult importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + ImportExportOperationResultInner inner = + this.serviceClient().importMethod(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ImportExportOperationResult importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + ImportExportOperationResultInner inner = + this.serviceClient().importMethod(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ImportExportsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java new file mode 100644 index 0000000000000..db69cb06df450 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroup; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import java.util.Collections; +import java.util.List; + +public final class InstanceFailoverGroupImpl + implements InstanceFailoverGroup, InstanceFailoverGroup.Definition, InstanceFailoverGroup.Update { + private InstanceFailoverGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerModel().readWriteEndpoint(); + } + + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerModel().readOnlyEndpoint(); + } + + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.innerModel().replicationRole(); + } + + public String replicationState() { + return this.innerModel().replicationState(); + } + + public List partnerRegions() { + List inner = this.innerModel().partnerRegions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List managedInstancePairs() { + List inner = this.innerModel().managedInstancePairs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public InstanceFailoverGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String locationName; + + private String failoverGroupName; + + public InstanceFailoverGroupImpl withExistingLocation(String resourceGroupName, String locationName) { + this.resourceGroupName = resourceGroupName; + this.locationName = locationName; + return this; + } + + public InstanceFailoverGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public InstanceFailoverGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), context); + return this; + } + + InstanceFailoverGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new InstanceFailoverGroupInner(); + this.serviceManager = serviceManager; + this.failoverGroupName = name; + } + + public InstanceFailoverGroupImpl update() { + return this; + } + + public InstanceFailoverGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public InstanceFailoverGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), context); + return this; + } + + InstanceFailoverGroupImpl( + InstanceFailoverGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.locationName = Utils.getValueFromIdByName(innerObject.id(), "locations"); + this.failoverGroupName = Utils.getValueFromIdByName(innerObject.id(), "instanceFailoverGroups"); + } + + public InstanceFailoverGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .getWithResponse(resourceGroupName, locationName, failoverGroupName, Context.NONE) + .getValue(); + return this; + } + + public InstanceFailoverGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .getWithResponse(resourceGroupName, locationName, failoverGroupName, context) + .getValue(); + return this; + } + + public InstanceFailoverGroupImpl withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.innerModel().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + public InstanceFailoverGroupImpl withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.innerModel().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + public InstanceFailoverGroupImpl withPartnerRegions(List partnerRegions) { + this.innerModel().withPartnerRegions(partnerRegions); + return this; + } + + public InstanceFailoverGroupImpl withManagedInstancePairs(List managedInstancePairs) { + this.innerModel().withManagedInstancePairs(managedInstancePairs); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java new file mode 100644 index 0000000000000..0421b4d8fc8a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java @@ -0,0 +1,1785 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.InstanceFailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InstanceFailoverGroupsClient. */ +public final class InstanceFailoverGroupsClientImpl implements InstanceFailoverGroupsClient { + private final ClientLogger logger = new ClientLogger(InstanceFailoverGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final InstanceFailoverGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of InstanceFailoverGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InstanceFailoverGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(InstanceFailoverGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientInstanceFailoverGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientI") + private interface InstanceFailoverGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @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.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InstanceFailoverGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> forceFailoverAllowDataLoss( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @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> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + return getWithResponseAsync(resourceGroupName, locationName, failoverGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName) { + return getAsync(resourceGroupName, locationName, failoverGroupName).block(); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstanceFailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + Context.NONE); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstanceFailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + context); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters).block(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters, context).block(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, failoverGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName).getSyncPoller(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName, context).getSyncPoller(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String failoverGroupName) { + deleteAsync(resourceGroupName, locationName, failoverGroupName).block(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context) { + deleteAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 instance failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + 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 the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @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 instance failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 instance failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String resourceGroupName, String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @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 instance failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String resourceGroupName, String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 instance failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName)); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @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 instance failover groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName, context)); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstanceFailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, locationName, failoverGroupName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + Context.NONE); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstanceFailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + context); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName).getSyncPoller(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName, context).getSyncPoller(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner failover( + String resourceGroupName, String locationName, String failoverGroupName) { + return failoverAsync(resourceGroupName, locationName, failoverGroupName).block(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return failoverAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, locationName, failoverGroupName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + Context.NONE); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLossAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + context); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName).getSyncPoller(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName, context) + .getSyncPoller(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName).block(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return forceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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.listByLocationNext(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 instance failover groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + 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 + .listByLocationNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.java new file mode 100644 index 0000000000000..7d2ecf9c5d6c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.InstanceFailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroup; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class InstanceFailoverGroupsImpl implements InstanceFailoverGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceFailoverGroupsImpl.class); + + private final InstanceFailoverGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public InstanceFailoverGroupsImpl( + InstanceFailoverGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public InstanceFailoverGroup get(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupInner inner = this.serviceClient().get(resourceGroupName, locationName, failoverGroupName); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, locationName, failoverGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InstanceFailoverGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String locationName, String failoverGroupName) { + this.serviceClient().delete(resourceGroupName, locationName, failoverGroupName); + } + + public void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, locationName, failoverGroupName, context); + } + + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new InstanceFailoverGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName, context); + return Utils.mapPage(inner, inner1 -> new InstanceFailoverGroupImpl(inner1, this.manager())); + } + + public InstanceFailoverGroup failover(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupInner inner = + this.serviceClient().failover(resourceGroupName, locationName, failoverGroupName); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + InstanceFailoverGroupInner inner = + this.serviceClient().failover(resourceGroupName, locationName, failoverGroupName, context); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupInner inner = + this.serviceClient().forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + InstanceFailoverGroupInner inner = + this + .serviceClient() + .forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, context); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup 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 locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, locationName, failoverGroupName, 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 locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, locationName, failoverGroupName, 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 locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + this.delete(resourceGroupName, locationName, failoverGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + this.delete(resourceGroupName, locationName, failoverGroupName, context); + } + + private InstanceFailoverGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public InstanceFailoverGroupImpl define(String name) { + return new InstanceFailoverGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolImpl.java new file mode 100644 index 0000000000000..eb733cb6c45dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.InstancePoolUpdate; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class InstancePoolImpl implements InstancePool, InstancePool.Definition, InstancePool.Update { + private InstancePoolInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public String subnetId() { + return this.innerModel().subnetId(); + } + + public Integer vCores() { + return this.innerModel().vCores(); + } + + public InstancePoolLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public InstancePoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String instancePoolName; + + private InstancePoolUpdate updateParameters; + + public InstancePoolImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public InstancePool create() { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .createOrUpdate(resourceGroupName, instancePoolName, this.innerModel(), Context.NONE); + return this; + } + + public InstancePool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .createOrUpdate(resourceGroupName, instancePoolName, this.innerModel(), context); + return this; + } + + InstancePoolImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new InstancePoolInner(); + this.serviceManager = serviceManager; + this.instancePoolName = name; + } + + public InstancePoolImpl update() { + this.updateParameters = new InstancePoolUpdate(); + return this; + } + + public InstancePool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .update(resourceGroupName, instancePoolName, updateParameters, Context.NONE); + return this; + } + + public InstancePool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .update(resourceGroupName, instancePoolName, updateParameters, context); + return this; + } + + InstancePoolImpl(InstancePoolInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.instancePoolName = Utils.getValueFromIdByName(innerObject.id(), "instancePools"); + } + + public InstancePool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .getByResourceGroupWithResponse(resourceGroupName, instancePoolName, Context.NONE) + .getValue(); + return this; + } + + public InstancePool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .getByResourceGroupWithResponse(resourceGroupName, instancePoolName, context) + .getValue(); + return this; + } + + public InstancePoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public InstancePoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public InstancePoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public InstancePoolImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public InstancePoolImpl withSubnetId(String subnetId) { + this.innerModel().withSubnetId(subnetId); + return this; + } + + public InstancePoolImpl withVCores(Integer vCores) { + this.innerModel().withVCores(vCores); + return this; + } + + public InstancePoolImpl withLicenseType(InstancePoolLicenseType licenseType) { + this.innerModel().withLicenseType(licenseType); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java new file mode 100644 index 0000000000000..94dc420ebad86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java @@ -0,0 +1,1573 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.InstancePoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePoolListResult; +import com.azure.resourcemanager.sql.generated.models.InstancePoolUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InstancePoolsClient. */ +public final class InstancePoolsClientImpl implements InstancePoolsClient { + private final ClientLogger logger = new ClientLogger(InstancePoolsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final InstancePoolsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of InstancePoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InstancePoolsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(InstancePoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientInstancePools to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientI") + private interface InstancePoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @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.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InstancePoolInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InstancePoolUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools") + @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.Sql/instancePools") + @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 an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String instancePoolName) { + 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String instancePoolName, 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String instancePoolName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, instancePoolName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner getByResourceGroup(String resourceGroupName, String instancePoolName) { + return getByResourceGroupAsync(resourceGroupName, instancePoolName).block(); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, instancePoolName, context).block(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstancePoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, instancePoolName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), InstancePoolInner.class, InstancePoolInner.class, Context.NONE); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstancePoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, instancePoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), InstancePoolInner.class, InstancePoolInner.class, context); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner createOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return createOrUpdateAsync(resourceGroupName, instancePoolName, parameters).block(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner createOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, instancePoolName, parameters, context).block(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 instancePoolName) { + 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @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 instancePoolName, 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String instancePoolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, instancePoolName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String instancePoolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, instancePoolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String instancePoolName) { + return beginDeleteAsync(resourceGroupName, instancePoolName).getSyncPoller(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String instancePoolName, Context context) { + return beginDeleteAsync(resourceGroupName, instancePoolName, context).getSyncPoller(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 instancePoolName) { + return beginDeleteAsync(resourceGroupName, instancePoolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String instancePoolName, Context context) { + return beginDeleteAsync(resourceGroupName, instancePoolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 instancePoolName) { + deleteAsync(resourceGroupName, instancePoolName).block(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String instancePoolName, Context context) { + deleteAsync(resourceGroupName, instancePoolName, context).block(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstancePoolInner> beginUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, instancePoolName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), InstancePoolInner.class, InstancePoolInner.class, Context.NONE); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InstancePoolInner> beginUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, instancePoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), InstancePoolInner.class, InstancePoolInner.class, context); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters).getSyncPoller(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters, context).getSyncPoller(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner update(String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + return updateAsync(resourceGroupName, instancePoolName, parameters).block(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @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 an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner update( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + return updateAsync(resourceGroupName, instancePoolName, parameters, context).block(); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the 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 a list of Azure SQL instance pools. + */ + @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 Azure SQL instance pools. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL instance pools. + */ + @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 a list of Azure SQL instance pools. + */ + @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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.java new file mode 100644 index 0000000000000..dff518bfdef15 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.InstancePoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import com.azure.resourcemanager.sql.generated.models.InstancePools; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class InstancePoolsImpl implements InstancePools { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstancePoolsImpl.class); + + private final InstancePoolsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public InstancePoolsImpl( + InstancePoolsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public InstancePool getByResourceGroup(String resourceGroupName, String instancePoolName) { + InstancePoolInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, instancePoolName); + if (inner != null) { + return new InstancePoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, instancePoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InstancePoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String instancePoolName) { + this.serviceClient().delete(resourceGroupName, instancePoolName); + } + + public void delete(String resourceGroupName, String instancePoolName, Context context) { + this.serviceClient().delete(resourceGroupName, instancePoolName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public InstancePool 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 instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, instancePoolName, 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 instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, instancePoolName, 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 instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + this.delete(resourceGroupName, instancePoolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + this.delete(resourceGroupName, instancePoolName, context); + } + + private InstancePoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public InstancePoolImpl define(String name) { + return new InstancePoolImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentImpl.java new file mode 100644 index 0000000000000..9cbb740563c31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import com.azure.resourcemanager.sql.generated.models.JobAgentState; +import com.azure.resourcemanager.sql.generated.models.JobAgentUpdate; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class JobAgentImpl implements JobAgent, JobAgent.Definition, JobAgent.Update { + private JobAgentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public String databaseId() { + return this.innerModel().databaseId(); + } + + public JobAgentState state() { + return this.innerModel().state(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public JobAgentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private JobAgentUpdate updateParameters; + + public JobAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public JobAgent create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .createOrUpdate(resourceGroupName, serverName, jobAgentName, this.innerModel(), Context.NONE); + return this; + } + + public JobAgent create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .createOrUpdate(resourceGroupName, serverName, jobAgentName, this.innerModel(), context); + return this; + } + + JobAgentImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobAgentInner(); + this.serviceManager = serviceManager; + this.jobAgentName = name; + } + + public JobAgentImpl update() { + this.updateParameters = new JobAgentUpdate(); + return this; + } + + public JobAgent apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .update(resourceGroupName, serverName, jobAgentName, updateParameters, Context.NONE); + return this; + } + + public JobAgent apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .update(resourceGroupName, serverName, jobAgentName, updateParameters, context); + return this; + } + + JobAgentImpl(JobAgentInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + } + + public JobAgent refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .getWithResponse(resourceGroupName, serverName, jobAgentName, Context.NONE) + .getValue(); + return this; + } + + public JobAgent refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .getWithResponse(resourceGroupName, serverName, jobAgentName, context) + .getValue(); + return this; + } + + public JobAgentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public JobAgentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public JobAgentImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public JobAgentImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public JobAgentImpl withDatabaseId(String databaseId) { + this.innerModel().withDatabaseId(databaseId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java new file mode 100644 index 0000000000000..72ff713eb0fb3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java @@ -0,0 +1,1433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.JobAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgentListResult; +import com.azure.resourcemanager.sql.generated.models.JobAgentUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobAgentsClient. */ +public final class JobAgentsClientImpl implements JobAgentsClient { + private final ClientLogger logger = new ClientLogger(JobAgentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobAgentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobAgentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobAgents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobAgentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobAgentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobAgentUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of job agents in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String jobAgentName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner get(String resourceGroupName, String serverName, String jobAgentName) { + return getAsync(resourceGroupName, serverName, jobAgentName).block(); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, context).block(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobAgentInner.class, JobAgentInner.class, Context.NONE); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobAgentInner.class, JobAgentInner.class, context); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters).block(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context).block(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @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 serverName, String jobAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String jobAgentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String jobAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName).getSyncPoller(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName, context).getSyncPoller(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String jobAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String jobAgentName) { + deleteAsync(resourceGroupName, serverName, jobAgentName).block(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String jobAgentName, Context context) { + deleteAsync(resourceGroupName, serverName, jobAgentName, context).block(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobAgentInner> beginUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobAgentInner.class, JobAgentInner.class, Context.NONE); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobAgentInner> beginUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobAgentInner.class, JobAgentInner.class, context); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters).getSyncPoller(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context).getSyncPoller(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner update( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + return updateAsync(resourceGroupName, serverName, jobAgentName, parameters).block(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param parameters The update to the job agent. + * @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 an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner update( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverName, jobAgentName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL job agents. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 Azure SQL job agents. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.java new file mode 100644 index 0000000000000..3b85bf8d013be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import com.azure.resourcemanager.sql.generated.models.JobAgents; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobAgentsImpl implements JobAgents { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobAgentsImpl.class); + + private final JobAgentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobAgentsImpl( + JobAgentsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new JobAgentImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new JobAgentImpl(inner1, this.manager())); + } + + public JobAgent get(String resourceGroupName, String serverName, String jobAgentName) { + JobAgentInner inner = this.serviceClient().get(resourceGroupName, serverName, jobAgentName); + if (inner != null) { + return new JobAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobAgentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName); + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, context); + } + + public JobAgent 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + this.delete(resourceGroupName, serverName, jobAgentName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + this.delete(resourceGroupName, serverName, jobAgentName, context); + } + + private JobAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobAgentImpl define(String name) { + return new JobAgentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialImpl.java new file mode 100644 index 0000000000000..4f168e49d5ac9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.azure.resourcemanager.sql.generated.models.JobCredential; + +public final class JobCredentialImpl implements JobCredential, JobCredential.Definition, JobCredential.Update { + private JobCredentialInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public JobCredentialInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String credentialName; + + public JobCredentialImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + public JobCredential create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobCredential create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), context) + .getValue(); + return this; + } + + JobCredentialImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobCredentialInner(); + this.serviceManager = serviceManager; + this.credentialName = name; + } + + public JobCredentialImpl update() { + return this; + } + + public JobCredential apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobCredential apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), context) + .getValue(); + return this; + } + + JobCredentialImpl( + JobCredentialInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.credentialName = Utils.getValueFromIdByName(innerObject.id(), "credentials"); + } + + public JobCredential refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, Context.NONE) + .getValue(); + return this; + } + + public JobCredential refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context) + .getValue(); + return this; + } + + public JobCredentialImpl withUsername(String username) { + this.innerModel().withUsername(username); + return this; + } + + public JobCredentialImpl withPassword(String password) { + this.innerModel().withPassword(password); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsClientImpl.java new file mode 100644 index 0000000000000..e60b615885e6e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsClientImpl.java @@ -0,0 +1,997 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobCredentialsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.azure.resourcemanager.sql.generated.models.JobCredentialListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobCredentialsClient. */ +public final class JobCredentialsClientImpl implements JobCredentialsClient { + private final ClientLogger logger = new ClientLogger(JobCredentialsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobCredentialsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobCredentialsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobCredentialsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobCredentialsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobCredentials to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobCredentialsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("credentialName") String credentialName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("credentialName") String credentialName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobCredentialInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("credentialName") String credentialName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 jobs credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs credentials. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 jobs credentials. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs credentials. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName)); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 jobs credentials. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName, context)); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobCredentialInner get( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getAsync(resourceGroupName, serverName, jobAgentName, credentialName).block(); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, context).block(); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @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 stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobCredentialInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).block(); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @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 stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, credentialName, parameters, context) + .block(); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName, String credentialName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName, String credentialName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String jobAgentName, String credentialName) { + deleteAsync(resourceGroupName, serverName, jobAgentName, credentialName).block(); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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.listByAgentNext(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 job credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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 + .listByAgentNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.java new file mode 100644 index 0000000000000..9f5e6a6118276 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobCredentialsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.azure.resourcemanager.sql.generated.models.JobCredential; +import com.azure.resourcemanager.sql.generated.models.JobCredentials; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobCredentialsImpl implements JobCredentials { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCredentialsImpl.class); + + private final JobCredentialsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobCredentialsImpl( + JobCredentialsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobCredentialImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName, context); + return Utils.mapPage(inner, inner1 -> new JobCredentialImpl(inner1, this.manager())); + } + + public JobCredential get(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + JobCredentialInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, credentialName); + if (inner != null) { + return new JobCredentialImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobCredentialImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, credentialName); + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context); + } + + public JobCredential 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context); + } + + private JobCredentialsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobCredentialImpl define(String name) { + return new JobCredentialImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionImpl.java new file mode 100644 index 0000000000000..6270223f5a13b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobExecutionLifecycle; +import com.azure.resourcemanager.sql.generated.models.JobExecutionTarget; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobExecutionImpl implements JobExecution { + private JobExecutionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + JobExecutionImpl(JobExecutionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer jobVersion() { + return this.innerModel().jobVersion(); + } + + public String stepName() { + return this.innerModel().stepName(); + } + + public Integer stepId() { + return this.innerModel().stepId(); + } + + public UUID jobExecutionId() { + return this.innerModel().jobExecutionId(); + } + + public JobExecutionLifecycle lifecycle() { + return this.innerModel().lifecycle(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime createTime() { + return this.innerModel().createTime(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Integer currentAttempts() { + return this.innerModel().currentAttempts(); + } + + public OffsetDateTime currentAttemptStartTime() { + return this.innerModel().currentAttemptStartTime(); + } + + public String lastMessage() { + return this.innerModel().lastMessage(); + } + + public JobExecutionTarget target() { + return this.innerModel().target(); + } + + public JobExecutionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java new file mode 100644 index 0000000000000..e9ff2278a5097 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java @@ -0,0 +1,2187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.JobExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecutionListResult; +import java.nio.ByteBuffer; +import java.time.OffsetDateTime; +import java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobExecutionsClient. */ +public final class JobExecutionsClientImpl implements JobExecutionsClient { + private final ClientLogger logger = new ClientLogger(JobExecutionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobExecutionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobExecutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobExecutionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobExecutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobExecutions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobExecutionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/executions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJob( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @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> listByAgentNext( + @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> listByJobNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + 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 executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByAgentSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByAgentSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByAgentSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByAgentAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByAgentAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> cancelWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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> cancelWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cancelAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return cancelWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancel( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + cancelAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).block(); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return cancelWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .block(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobExecutionInner> beginCreateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobExecutionInner.class, JobExecutionInner.class, Context.NONE); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobExecutionInner> beginCreateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobExecutionInner.class, JobExecutionInner.class, context); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName).getSyncPoller(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName, context).getSyncPoller(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createAsync(resourceGroupName, serverName, jobAgentName, jobName).block(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return createAsync(resourceGroupName, serverName, jobAgentName, jobName, context).block(); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + 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 a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByJobSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByJobSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByJobSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByJobNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByJobAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByJobAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @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 job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).block(); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @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 job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .block(); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobExecutionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobExecutionInner.class, JobExecutionInner.class, Context.NONE); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, JobExecutionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobExecutionInner.class, JobExecutionInner.class, context); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .getSyncPoller(); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .getSyncPoller(); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).block(); + } + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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.listByAgentNext(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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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 + .listByAgentNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(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.listByJobNext(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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(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 + .listByJobNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java new file mode 100644 index 0000000000000..2734d4bc5ae64 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobExecutions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobExecutionsImpl implements JobExecutions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobExecutionsImpl.class); + + private final JobExecutionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobExecutionsImpl( + JobExecutionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByAgent( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public void cancel( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + this.serviceClient().cancel(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + } + + public Response cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return this + .serviceClient() + .cancelWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + } + + public JobExecution create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobExecutionInner inner = this.serviceClient().create(resourceGroupName, serverName, jobAgentName, jobName); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public JobExecution create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + JobExecutionInner inner = + this.serviceClient().create(resourceGroupName, serverName, jobAgentName, jobName, context); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByJob( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public JobExecution get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobExecutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobExecution createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public JobExecution createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + JobExecutionInner inner = + this + .serviceClient() + .createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + private JobExecutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobImpl.java new file mode 100644 index 0000000000000..c9f03c529c6e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.azure.resourcemanager.sql.generated.models.Job; +import com.azure.resourcemanager.sql.generated.models.JobSchedule; + +public final class JobImpl implements Job, Job.Definition, Job.Update { + private JobInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public Integer version() { + return this.innerModel().version(); + } + + public JobSchedule schedule() { + return this.innerModel().schedule(); + } + + public JobInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String jobName; + + public JobImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + public Job create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Job create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), context) + .getValue(); + return this; + } + + JobImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobInner(); + this.serviceManager = serviceManager; + this.jobName = name; + } + + public JobImpl update() { + return this; + } + + public Job apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Job apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), context) + .getValue(); + return this; + } + + JobImpl(JobInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.jobName = Utils.getValueFromIdByName(innerObject.id(), "jobs"); + } + + public Job refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, Context.NONE) + .getValue(); + return this; + } + + public Job refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context) + .getValue(); + return this; + } + + public JobImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public JobImpl withSchedule(JobSchedule schedule) { + this.innerModel().withSchedule(schedule); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java new file mode 100644 index 0000000000000..a68f417b748ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java @@ -0,0 +1,872 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobStepExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecutionListResult; +import java.time.OffsetDateTime; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobStepExecutionsClient. */ +public final class JobStepExecutionsClientImpl implements JobStepExecutionsClient { + private final ClientLogger logger = new ClientLogger(JobStepExecutionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobStepExecutionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepExecutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobStepExecutionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobStepExecutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobStepExecutions to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobStepExecutionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobExecution( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("stepName") String stepName, + @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> listByJobExecutionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + 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 the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @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 step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + return getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).block(); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @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 step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync(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.listByJobExecutionNext(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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync( + 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 + .listByJobExecutionNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java new file mode 100644 index 0000000000000..c46db90cde427 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobStepExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobStepExecutionsImpl implements JobStepExecutions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStepExecutionsImpl.class); + + private final JobStepExecutionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobStepExecutionsImpl( + JobStepExecutionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + JobExecutionInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobExecutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private JobStepExecutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepImpl.java new file mode 100644 index 0000000000000..8665b50f108c4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepImpl.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.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.azure.resourcemanager.sql.generated.models.JobStep; +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; + +public final class JobStepImpl implements JobStep, JobStep.Definition, JobStep.Update { + private JobStepInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer stepId() { + return this.innerModel().stepId(); + } + + public String targetGroup() { + return this.innerModel().targetGroup(); + } + + public String credential() { + return this.innerModel().credential(); + } + + public JobStepAction action() { + return this.innerModel().action(); + } + + public JobStepOutput output() { + return this.innerModel().output(); + } + + public JobStepExecutionOptions executionOptions() { + return this.innerModel().executionOptions(); + } + + public JobStepInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String jobName; + + private String stepName; + + public JobStepImpl withExistingJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + this.jobName = jobName; + return this; + } + + public JobStep create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobStep create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), context) + .getValue(); + return this; + } + + JobStepImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobStepInner(); + this.serviceManager = serviceManager; + this.stepName = name; + } + + public JobStepImpl update() { + return this; + } + + public JobStep apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobStep apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), context) + .getValue(); + return this; + } + + JobStepImpl(JobStepInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.jobName = Utils.getValueFromIdByName(innerObject.id(), "jobs"); + this.stepName = Utils.getValueFromIdByName(innerObject.id(), "steps"); + } + + public JobStep refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, Context.NONE) + .getValue(); + return this; + } + + public JobStep refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context) + .getValue(); + return this; + } + + public JobStepImpl withStepId(Integer stepId) { + this.innerModel().withStepId(stepId); + return this; + } + + public JobStepImpl withTargetGroup(String targetGroup) { + this.innerModel().withTargetGroup(targetGroup); + return this; + } + + public JobStepImpl withCredential(String credential) { + this.innerModel().withCredential(credential); + return this; + } + + public JobStepImpl withAction(JobStepAction action) { + this.innerModel().withAction(action); + return this; + } + + public JobStepImpl withOutput(JobStepOutput output) { + this.innerModel().withOutput(output); + return this; + } + + public JobStepImpl withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.innerModel().withExecutionOptions(executionOptions); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java new file mode 100644 index 0000000000000..1033f3b99c3d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java @@ -0,0 +1,1675 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobStepsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.azure.resourcemanager.sql.generated.models.JobStepListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobStepsClient. */ +public final class JobStepsClientImpl implements JobStepsClient { + private final ClientLogger logger = new ClientLogger(JobStepsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobStepsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobStepsClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(JobStepsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobSteps to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobStepsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVersion( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobVersion") int jobVersion, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByVersion( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobVersion") int jobVersion, + @PathParam("stepName") String stepName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJob( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("stepName") String stepName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("stepName") String stepName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobStepInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("stepName") String stepName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVersionNext( + @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> listByJobNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + 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 job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVersionAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return new PagedFlux<>( + () -> listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), + nextLink -> listByVersionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVersionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + return new PagedFlux<>( + () -> + listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context), + nextLink -> listByVersionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return new PagedIterable<>( + listByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion)); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 job steps in the specified job version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + return new PagedIterable<>( + listByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context)); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByVersionWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByVersionWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByVersionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + return getByVersionWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobStepInner getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + return getByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).block(); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context) { + return getByVersionWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, context) + .block(); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + 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 job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, context), + nextLink -> listByJobNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName)); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job steps for a job's current version. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName, context)); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobStepInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).block(); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, context).block(); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobStepInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).block(); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters, context) + .block(); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName, String jobName, String stepName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, + String jobAgentName, + String jobName, + String stepName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName, String jobName, String stepName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String jobAgentName, String jobName, String stepName) { + deleteAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).block(); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionNextSinglePageAsync(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.listByVersionNext(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 job steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionNextSinglePageAsync(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 + .listByVersionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(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.listByJobNext(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 job steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(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 + .listByJobNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java new file mode 100644 index 0000000000000..003aa0696e53e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobStepsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.azure.resourcemanager.sql.generated.models.JobStep; +import com.azure.resourcemanager.sql.generated.models.JobSteps; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobStepsImpl implements JobSteps { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStepsImpl.class); + + private final JobStepsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobStepsImpl(JobStepsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + PagedIterable inner = + this.serviceClient().listByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public JobStep getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + JobStepInner inner = + this + .serviceClient() + .getByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName); + if (inner != null) { + return new JobStepImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context) { + Response inner = + this + .serviceClient() + .getByVersionWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobStepImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName, context); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public JobStep get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + JobStepInner inner = this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, stepName); + if (inner != null) { + return new JobStepImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobStepImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, jobName, stepName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context); + } + + public JobStep 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + this + .deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context); + } + + private JobStepsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobStepImpl define(String name) { + return new JobStepImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java new file mode 100644 index 0000000000000..4fb56b0bc23c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java @@ -0,0 +1,1479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobTargetExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecutionListResult; +import java.time.OffsetDateTime; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobTargetExecutionsClient. */ +public final class JobTargetExecutionsClientImpl implements JobTargetExecutionsClient { + private final ClientLogger logger = new ClientLogger(JobTargetExecutionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobTargetExecutionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetExecutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobTargetExecutionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobTargetExecutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobTargetExecutions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobTargetExecutionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/targets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobExecution( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}" + + "/targets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByStep( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("stepName") String stepName, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}" + + "/targets/{targetId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("stepName") String stepName, + @PathParam("targetId") UUID targetId, + @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> listByJobExecutionNext( + @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> listByStepNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + 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 target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByStep( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + 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 the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByStep( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByStepAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByStepSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByStepNextSinglePageAsync(nextLink)); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByStepAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByStepSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByStepNextSinglePageAsync(nextLink)); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByStepAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByStepSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByStepNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByStepAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 job executions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByStepAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (targetId == null) { + return Mono.error(new IllegalArgumentException("Parameter targetId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + targetId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target id. + * @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 target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (targetId == null) { + return Mono.error(new IllegalArgumentException("Parameter targetId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + targetId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + return getWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + return getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId) + .block(); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target id. + * @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 target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync(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.listByJobExecutionNext(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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync( + 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 + .listByJobExecutionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepNextSinglePageAsync(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.listByStepNext(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 job executions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepNextSinglePageAsync(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 + .listByStepNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.java new file mode 100644 index 0000000000000..d5e9c4e062096 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobTargetExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobTargetExecutions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobTargetExecutionsImpl implements JobTargetExecutions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobTargetExecutionsImpl.class); + + private final JobTargetExecutionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobTargetExecutionsImpl( + JobTargetExecutionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + PagedIterable inner = + this + .serviceClient() + .listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByStep( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + JobExecutionInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobExecutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private JobTargetExecutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupImpl.java new file mode 100644 index 0000000000000..9e29be7fc40b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroup; +import java.util.Collections; +import java.util.List; + +public final class JobTargetGroupImpl implements JobTargetGroup, JobTargetGroup.Definition, JobTargetGroup.Update { + private JobTargetGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List members() { + List inner = this.innerModel().members(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public JobTargetGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String targetGroupName; + + public JobTargetGroupImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + public JobTargetGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobTargetGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + JobTargetGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobTargetGroupInner(); + this.serviceManager = serviceManager; + this.targetGroupName = name; + } + + public JobTargetGroupImpl update() { + return this; + } + + public JobTargetGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobTargetGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + JobTargetGroupImpl( + JobTargetGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.targetGroupName = Utils.getValueFromIdByName(innerObject.id(), "targetGroups"); + } + + public JobTargetGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, Context.NONE) + .getValue(); + return this; + } + + public JobTargetGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context) + .getValue(); + return this; + } + + public JobTargetGroupImpl withMembers(List members) { + this.innerModel().withMembers(members); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java new file mode 100644 index 0000000000000..68fc1a170914c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java @@ -0,0 +1,1003 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobTargetGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroupListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobTargetGroupsClient. */ +public final class JobTargetGroupsClientImpl implements JobTargetGroupsClient { + private final ClientLogger logger = new ClientLogger(JobTargetGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobTargetGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobTargetGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobTargetGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobTargetGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobTargetGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("targetGroupName") String targetGroupName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("targetGroupName") String targetGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobTargetGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("targetGroupName") String targetGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + 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 target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName)); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 target groups in an agent. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName, context)); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobTargetGroupInner get( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).block(); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, context).block(); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param parameters The requested state of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobTargetGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, parameters).block(); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param parameters The requested state of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, targetGroupName, parameters, context) + .block(); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + deleteAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).block(); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of target groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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.listByAgentNext(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 target groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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 + .listByAgentNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.java new file mode 100644 index 0000000000000..c51a1e5091d77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobTargetGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroup; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobTargetGroupsImpl implements JobTargetGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobTargetGroupsImpl.class); + + private final JobTargetGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobTargetGroupsImpl( + JobTargetGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobTargetGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName, context); + return Utils.mapPage(inner, inner1 -> new JobTargetGroupImpl(inner1, this.manager())); + } + + public JobTargetGroup get( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + JobTargetGroupInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, targetGroupName); + if (inner != null) { + return new JobTargetGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobTargetGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, targetGroupName); + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context); + } + + public JobTargetGroup 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context); + } + + private JobTargetGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobTargetGroupImpl define(String name) { + return new JobTargetGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionImpl.java new file mode 100644 index 0000000000000..1bcd2181deb00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.azure.resourcemanager.sql.generated.models.JobVersion; + +public final class JobVersionImpl implements JobVersion { + private JobVersionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + JobVersionImpl(JobVersionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public JobVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java new file mode 100644 index 0000000000000..b55046f785571 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java @@ -0,0 +1,597 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobVersionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.azure.resourcemanager.sql.generated.models.JobVersionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobVersionsClient. */ +public final class JobVersionsClientImpl implements JobVersionsClient { + private final ClientLogger logger = new ClientLogger(JobVersionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobVersionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobVersionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobVersions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobVersionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJob( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobVersion") int jobVersion, + @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> listByJobNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + 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 versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, context), + nextLink -> listByJobNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName)); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 versions of a job. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName, context)); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobVersionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).block(); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job versions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(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.listByJobNext(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 job versions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(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 + .listByJobNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.java new file mode 100644 index 0000000000000..720fe09f2d4db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.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.sql.generated.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.sql.generated.fluent.JobVersionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.azure.resourcemanager.sql.generated.models.JobVersion; +import com.azure.resourcemanager.sql.generated.models.JobVersions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobVersionsImpl implements JobVersions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobVersionsImpl.class); + + private final JobVersionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobVersionsImpl( + JobVersionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName); + return Utils.mapPage(inner, inner1 -> new JobVersionImpl(inner1, this.manager())); + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName, context); + return Utils.mapPage(inner, inner1 -> new JobVersionImpl(inner1, this.manager())); + } + + public JobVersion get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + JobVersionInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, jobVersion); + if (inner != null) { + return new JobVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private JobVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java new file mode 100644 index 0000000000000..4f89d8f714a09 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java @@ -0,0 +1,979 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.azure.resourcemanager.sql.generated.models.JobListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public final class JobsClientImpl implements JobsClient { + private final ClientLogger logger = new ClientLogger(JobsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobsClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(JobsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobs to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + private interface JobsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @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.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 jobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync(String resourceGroupName, String serverName, String jobAgentName) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 jobs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 jobs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName)); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 jobs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName, context)); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getAsync(resourceGroupName, serverName, jobAgentName, jobName).block(); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, context).block(); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + JobInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).block(); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + JobInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, parameters, context) + .block(); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName, String jobName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String jobAgentName, String jobName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String jobAgentName, String jobName) { + deleteAsync(resourceGroupName, serverName, jobAgentName, jobName).block(); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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.listByAgentNext(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 jobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(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 + .listByAgentNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.java new file mode 100644 index 0000000000000..39cdbd37f738b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.JobsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.azure.resourcemanager.sql.generated.models.Job; +import com.azure.resourcemanager.sql.generated.models.Jobs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobsImpl implements Jobs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobsImpl.class); + + private final JobsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobsImpl(JobsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName, context); + return Utils.mapPage(inner, inner1 -> new JobImpl(inner1, this.manager())); + } + + public Job get(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobInner inner = this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName); + if (inner != null) { + return new JobImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, jobName); + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context); + } + + public Job 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context); + } + + private JobsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobImpl define(String name) { + return new JobImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LocationCapabilitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LocationCapabilitiesImpl.java new file mode 100644 index 0000000000000..74286783c119b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LocationCapabilitiesImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.CapabilityStatus; +import com.azure.resourcemanager.sql.generated.models.LocationCapabilities; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVersionCapability; +import com.azure.resourcemanager.sql.generated.models.ServerVersionCapability; +import java.util.Collections; +import java.util.List; + +public final class LocationCapabilitiesImpl implements LocationCapabilities { + private LocationCapabilitiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + LocationCapabilitiesImpl( + LocationCapabilitiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public List supportedServerVersions() { + List inner = this.innerModel().supportedServerVersions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List supportedManagedInstanceVersions() { + List inner = this.innerModel().supportedManagedInstanceVersions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CapabilityStatus status() { + return this.innerModel().status(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public LocationCapabilitiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupImpl.java new file mode 100644 index 0000000000000..c88c00883e3cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackup; +import java.time.OffsetDateTime; + +public final class LongTermRetentionBackupImpl implements LongTermRetentionBackup { + private LongTermRetentionBackupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + LongTermRetentionBackupImpl( + LongTermRetentionBackupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime serverCreateTime() { + return this.innerModel().serverCreateTime(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime databaseDeletionTime() { + return this.innerModel().databaseDeletionTime(); + } + + public OffsetDateTime backupTime() { + return this.innerModel().backupTime(); + } + + public OffsetDateTime backupExpirationTime() { + return this.innerModel().backupExpirationTime(); + } + + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerModel().backupStorageRedundancy(); + } + + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerModel().requestedBackupStorageRedundancy(); + } + + public LongTermRetentionBackupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupOperationResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupOperationResultImpl.java new file mode 100644 index 0000000000000..c01fb27309d45 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupOperationResultImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackupOperationResult; +import java.util.UUID; + +public final class LongTermRetentionBackupOperationResultImpl implements LongTermRetentionBackupOperationResult { + private LongTermRetentionBackupOperationResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + LongTermRetentionBackupOperationResultImpl( + LongTermRetentionBackupOperationResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public UUID requestId() { + return this.innerModel().requestId(); + } + + public String operationType() { + return this.innerModel().operationType(); + } + + public String fromBackupResourceId() { + return this.innerModel().fromBackupResourceId(); + } + + public String toBackupResourceId() { + return this.innerModel().toBackupResourceId(); + } + + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.innerModel().targetBackupStorageRedundancy(); + } + + public String status() { + return this.innerModel().status(); + } + + public String message() { + return this.innerModel().message(); + } + + public LongTermRetentionBackupOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java new file mode 100644 index 0000000000000..1c2ce31fbfac8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java @@ -0,0 +1,5371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackupListResult; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionBackupsClient. */ +public final class LongTermRetentionBackupsClientImpl implements LongTermRetentionBackupsClient { + private final ClientLogger logger = new ClientLogger(LongTermRetentionBackupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LongTermRetentionBackupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionBackupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LongTermRetentionBackupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(LongTermRetentionBackupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLongTermRetentionBackups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + private interface LongTermRetentionBackupsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}/copy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> copy( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CopyLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}/update") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations/{locationName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/copy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> copyByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CopyLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/update") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations" + + "/{locationName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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> listByDatabaseNext( + @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> listByLocationNext( + @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> listByServerNext( + @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> listByResourceGroupDatabaseNext( + @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> listByResourceGroupLocationNext( + @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> listByResourceGroupServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .copy( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .copy( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + Mono>> mono = + copyWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + Context.NONE); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + copyWithResponseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return copyAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .block(); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return copyAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + Mono>> mono = + updateWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + Context.NONE); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return updateAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return updateAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupInner get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).block(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return getWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .block(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + Mono>> mono = + deleteWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).block(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .block(); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByDatabaseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByServerSinglePageAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByServerSinglePageAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByServerSinglePageAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByServerAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .copyByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .copyByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + Mono>> mono = + copyByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + Context.NONE); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + copyByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return copyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .block(); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return copyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + Mono>> mono = + updateByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + Context.NONE); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return updateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return updateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getByResourceGroupAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .block(); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .block(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + deleteByResourceGroupAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .block(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + deleteByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .block(); + } + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupLocationAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupServer( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupServer( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupServerAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupServerSinglePageAsync( + resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupServerAsync( + String resourceGroupName, String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupServerSinglePageAsync( + resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupServerAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupServerSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupServerAsync( + resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupServerAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + 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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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.listByLocationNext(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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + 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 + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseNextSinglePageAsync( + 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.listByResourceGroupDatabaseNext(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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseNextSinglePageAsync( + 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 + .listByResourceGroupDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationNextSinglePageAsync( + 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.listByResourceGroupLocationNext(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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationNextSinglePageAsync( + 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 + .listByResourceGroupLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerNextSinglePageAsync( + 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.listByResourceGroupServerNext(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 long term retention backups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerNextSinglePageAsync( + 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 + .listByResourceGroupServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java new file mode 100644 index 0000000000000..d41fd02455f7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java @@ -0,0 +1,515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.LongTermRetentionBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackup; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackupOperationResult; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackups; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LongTermRetentionBackupsImpl implements LongTermRetentionBackups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionBackupsImpl.class); + + private final LongTermRetentionBackupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LongTermRetentionBackupsImpl( + LongTermRetentionBackupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copy(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copy( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .update( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .update( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackup get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + LongTermRetentionBackupInner inner = + this + .serviceClient() + .get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + if (inner != null) { + return new LongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + this + .serviceClient() + .delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + } + + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + this + .serviceClient() + .delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context); + } + + public PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String locationName, String longTermRetentionServerName) { + PagedIterable inner = + this.serviceClient().listByServer(locationName, longTermRetentionServerName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copyByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copyByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .updateByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .updateByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + LongTermRetentionBackupInner inner = + this + .serviceClient() + .getByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName); + if (inner != null) { + return new LongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + this + .serviceClient() + .deleteByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName); + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + this + .serviceClient() + .deleteByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByResourceGroupLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupLocation( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupServer(resourceGroupName, locationName, longTermRetentionServerName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupServer( + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + private LongTermRetentionBackupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java new file mode 100644 index 0000000000000..37e5f78309c6a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java @@ -0,0 +1,3352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionManagedInstanceBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionBackupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * LongTermRetentionManagedInstanceBackupsClient. + */ +public final class LongTermRetentionManagedInstanceBackupsClientImpl + implements LongTermRetentionManagedInstanceBackupsClient { + private final ClientLogger logger = new ClientLogger(LongTermRetentionManagedInstanceBackupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LongTermRetentionManagedInstanceBackupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionManagedInstanceBackupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LongTermRetentionManagedInstanceBackupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + LongTermRetentionManagedInstanceBackupsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLongTermRetentionManagedInstanceBackups to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + private interface LongTermRetentionManagedInstanceBackupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}" + + "/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}" + + "/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}" + + "/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases" + + "/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases" + + "/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases" + + "/{databaseName}/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}" + + "/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @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> listByDatabaseNext( + @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> listByInstanceNext( + @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> listByLocationNext( + @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> listByResourceGroupDatabaseNext( + @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> listByResourceGroupInstanceNext( + @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> listByResourceGroupLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return getWithResponseAsync(locationName, managedInstanceName, databaseName, backupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionBackupInner get( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return getAsync(locationName, managedInstanceName, databaseName, backupName).block(); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + return getWithResponseAsync(locationName, managedInstanceName, databaseName, backupName, context).block(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + Mono>> mono = + deleteWithResponseAsync(locationName, managedInstanceName, databaseName, backupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(locationName, managedInstanceName, databaseName, backupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName).getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName, context).getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String locationName, String managedInstanceName, String databaseName, String backupName) { + deleteAsync(locationName, managedInstanceName, databaseName, backupName).block(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + deleteAsync(locationName, managedInstanceName, databaseName, backupName, context).block(); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByDatabaseAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByInstanceSinglePageAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByInstanceSinglePageAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByInstanceSinglePageAsync( + locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return getByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .block(); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .block(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + deleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .block(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + deleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .block(); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupInstanceSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupInstance( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupInstanceSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupInstance( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupInstanceAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupInstanceSinglePageAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupInstanceAsync( + String resourceGroupName, String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupInstanceSinglePageAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupInstanceAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupInstanceSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupInstanceAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupInstanceAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + 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 the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupLocationAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, 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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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.listByInstanceNext(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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + 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.listByLocationNext(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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + 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 + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupDatabaseNextSinglePageAsync(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.listByResourceGroupDatabaseNext(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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupDatabaseNextSinglePageAsync(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 + .listByResourceGroupDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupInstanceNextSinglePageAsync(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.listByResourceGroupInstanceNext(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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupInstanceNextSinglePageAsync(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 + .listByResourceGroupInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupLocationNextSinglePageAsync(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.listByResourceGroupLocationNext(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 long term retention backups for managed database(s). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupLocationNextSinglePageAsync(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 + .listByResourceGroupLocationNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.java new file mode 100644 index 0000000000000..a66fb00466129 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.LongTermRetentionManagedInstanceBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionManagedInstanceBackups; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionBackup; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LongTermRetentionManagedInstanceBackupsImpl implements LongTermRetentionManagedInstanceBackups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionManagedInstanceBackupsImpl.class); + + private final LongTermRetentionManagedInstanceBackupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LongTermRetentionManagedInstanceBackupsImpl( + LongTermRetentionManagedInstanceBackupsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedInstanceLongTermRetentionBackup get( + String locationName, String managedInstanceName, String databaseName, String backupName) { + ManagedInstanceLongTermRetentionBackupInner inner = + this.serviceClient().get(locationName, managedInstanceName, databaseName, backupName); + if (inner != null) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(locationName, managedInstanceName, databaseName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceLongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String locationName, String managedInstanceName, String databaseName, String backupName) { + this.serviceClient().delete(locationName, managedInstanceName, databaseName, backupName); + } + + public void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + this.serviceClient().delete(locationName, managedInstanceName, databaseName, backupName, context); + } + + public PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(locationName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String locationName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(locationName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = + this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public ManagedInstanceLongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + ManagedInstanceLongTermRetentionBackupInner inner = + this + .serviceClient() + .getByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backupName); + if (inner != null) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceLongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + this + .serviceClient() + .deleteByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backupName); + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + this + .serviceClient() + .deleteByResourceGroup( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase(resourceGroupName, locationName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByResourceGroupInstance(resourceGroupName, locationName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupInstance( + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByResourceGroupLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupLocation( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + private LongTermRetentionManagedInstanceBackupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..0baf72d9f0124 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java @@ -0,0 +1,969 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionPoliciesClient. */ +public final class LongTermRetentionPoliciesClientImpl implements LongTermRetentionPoliciesClient { + private final ClientLogger logger = new ClientLogger(LongTermRetentionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LongTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LongTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + LongTermRetentionPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLongTermRetentionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + private interface LongTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") LongTermRetentionPolicyName policyName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") LongTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LongTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + return getAsync(resourceGroupName, serverName, databaseName, policyName).block(); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, context).block(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LongTermRetentionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionPolicyInner.class, + LongTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LongTermRetentionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionPolicyInner.class, + LongTermRetentionPolicyInner.class, + context); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).block(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 long term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(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 long term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..fa3ebff4a7d89 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.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.sql.generated.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.sql.generated.fluent.LongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LongTermRetentionPoliciesImpl implements LongTermRetentionPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionPoliciesImpl.class); + + private final LongTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LongTermRetentionPoliciesImpl( + LongTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LongTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + LongTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, policyName); + if (inner != null) { + return new LongTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LongTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public LongTermRetentionPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + LongTermRetentionPolicyName policyName = + LongTermRetentionPolicyName.fromString(Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + LongTermRetentionPolicyName policyName = + LongTermRetentionPolicyName.fromString(Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + } + + private LongTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public LongTermRetentionPolicyImpl define(LongTermRetentionPolicyName name) { + return new LongTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..11f9274f548ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPolicyImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +public final class LongTermRetentionPolicyImpl + implements LongTermRetentionPolicy, LongTermRetentionPolicy.Definition, LongTermRetentionPolicy.Update { + private LongTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String weeklyRetention() { + return this.innerModel().weeklyRetention(); + } + + public String monthlyRetention() { + return this.innerModel().monthlyRetention(); + } + + public String yearlyRetention() { + return this.innerModel().yearlyRetention(); + } + + public Integer weekOfYear() { + return this.innerModel().weekOfYear(); + } + + public LongTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private LongTermRetentionPolicyName policyName; + + public LongTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public LongTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public LongTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + LongTermRetentionPolicyImpl( + LongTermRetentionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new LongTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public LongTermRetentionPolicyImpl update() { + return this; + } + + public LongTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public LongTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + LongTermRetentionPolicyImpl( + LongTermRetentionPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + LongTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupLongTermRetentionPolicies")); + } + + public LongTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public LongTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, context) + .getValue(); + return this; + } + + public LongTermRetentionPolicyImpl withWeeklyRetention(String weeklyRetention) { + this.innerModel().withWeeklyRetention(weeklyRetention); + return this; + } + + public LongTermRetentionPolicyImpl withMonthlyRetention(String monthlyRetention) { + this.innerModel().withMonthlyRetention(monthlyRetention); + return this; + } + + public LongTermRetentionPolicyImpl withYearlyRetention(String yearlyRetention) { + this.innerModel().withYearlyRetention(yearlyRetention); + return this; + } + + public LongTermRetentionPolicyImpl withWeekOfYear(Integer weekOfYear) { + this.innerModel().withWeekOfYear(weekOfYear); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..4fba6ac3cb682 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedBackupShortTermRetentionPoliciesClient. + */ +public final class ManagedBackupShortTermRetentionPoliciesClientImpl + implements ManagedBackupShortTermRetentionPoliciesClient { + private final ClientLogger logger = new ClientLogger(ManagedBackupShortTermRetentionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedBackupShortTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedBackupShortTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedBackupShortTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedBackupShortTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedBackupShortTermRetentionPolicies to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedBackupShortTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, policyName).block(); + } + + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName, context).block(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .block(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters).block(); + } + + /** + * Updates a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, 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 short term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 short term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..99265f3478117 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedBackupShortTermRetentionPoliciesImpl implements ManagedBackupShortTermRetentionPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedBackupShortTermRetentionPoliciesImpl.class); + + private final ManagedBackupShortTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedBackupShortTermRetentionPoliciesImpl( + ManagedBackupShortTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + ManagedBackupShortTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, policyName); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedBackupShortTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public ManagedBackupShortTermRetentionPolicy 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + ManagedShortTermRetentionPolicyName policyName = + ManagedShortTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + ManagedShortTermRetentionPolicyName policyName = + ManagedShortTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + } + + private ManagedBackupShortTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedBackupShortTermRetentionPolicyImpl define(ManagedShortTermRetentionPolicyName name) { + return new ManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..b0f19ba87ed2d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +public final class ManagedBackupShortTermRetentionPolicyImpl + implements ManagedBackupShortTermRetentionPolicy, + ManagedBackupShortTermRetentionPolicy.Definition, + ManagedBackupShortTermRetentionPolicy.Update { + private ManagedBackupShortTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public ManagedBackupShortTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private ManagedShortTermRetentionPolicyName policyName; + + public ManagedBackupShortTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedBackupShortTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedBackupShortTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedBackupShortTermRetentionPolicyImpl( + ManagedShortTermRetentionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedBackupShortTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public ManagedBackupShortTermRetentionPolicyImpl update() { + return this; + } + + public ManagedBackupShortTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .update( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedBackupShortTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .update(resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedBackupShortTermRetentionPolicyImpl( + ManagedBackupShortTermRetentionPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + ManagedShortTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupShortTermRetentionPolicies")); + } + + public ManagedBackupShortTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedBackupShortTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context) + .getValue(); + return this; + } + + public ManagedBackupShortTermRetentionPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.java new file mode 100644 index 0000000000000..7cc9bacfc9f98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseUpdate; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ManagedDatabaseImpl implements ManagedDatabase, ManagedDatabase.Definition, ManagedDatabase.Update { + private ManagedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String collation() { + return this.innerModel().collation(); + } + + public ManagedDatabaseStatus status() { + return this.innerModel().status(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public OffsetDateTime earliestRestorePoint() { + return this.innerModel().earliestRestorePoint(); + } + + public OffsetDateTime restorePointInTime() { + return this.innerModel().restorePointInTime(); + } + + public String defaultSecondaryLocation() { + return this.innerModel().defaultSecondaryLocation(); + } + + public CatalogCollationType catalogCollation() { + return this.innerModel().catalogCollation(); + } + + public ManagedDatabaseCreateMode createMode() { + return this.innerModel().createMode(); + } + + public String storageContainerUri() { + return this.innerModel().storageContainerUri(); + } + + public String sourceDatabaseId() { + return this.innerModel().sourceDatabaseId(); + } + + public String restorableDroppedDatabaseId() { + return this.innerModel().restorableDroppedDatabaseId(); + } + + public String storageContainerSasToken() { + return this.innerModel().storageContainerSasToken(); + } + + public String failoverGroupId() { + return this.innerModel().failoverGroupId(); + } + + public String recoverableDatabaseId() { + return this.innerModel().recoverableDatabaseId(); + } + + public String longTermRetentionBackupResourceId() { + return this.innerModel().longTermRetentionBackupResourceId(); + } + + public Boolean autoCompleteRestore() { + return this.innerModel().autoCompleteRestore(); + } + + public String lastBackupName() { + return this.innerModel().lastBackupName(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ManagedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private ManagedDatabaseUpdate updateParameters; + + public ManagedDatabaseImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedDatabase create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .createOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedDatabase create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .createOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.innerModel(), context); + return this; + } + + ManagedDatabaseImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedDatabaseInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public ManagedDatabaseImpl update() { + this.updateParameters = new ManagedDatabaseUpdate(); + return this; + } + + public ManagedDatabase apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .update(resourceGroupName, managedInstanceName, databaseName, updateParameters, Context.NONE); + return this; + } + + public ManagedDatabase apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .update(resourceGroupName, managedInstanceName, databaseName, updateParameters, context); + return this; + } + + ManagedDatabaseImpl( + ManagedDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public ManagedDatabase refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabase refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, context) + .getValue(); + return this; + } + + public ManagedDatabaseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedDatabaseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedDatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ManagedDatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.innerModel().withCollation(collation); + return this; + } else { + this.updateParameters.withCollation(collation); + return this; + } + } + + public ManagedDatabaseImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + if (isInCreateMode()) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } else { + this.updateParameters.withRestorePointInTime(restorePointInTime); + return this; + } + } + + public ManagedDatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + if (isInCreateMode()) { + this.innerModel().withCatalogCollation(catalogCollation); + return this; + } else { + this.updateParameters.withCatalogCollation(catalogCollation); + return this; + } + } + + public ManagedDatabaseImpl withCreateMode(ManagedDatabaseCreateMode createMode) { + if (isInCreateMode()) { + this.innerModel().withCreateMode(createMode); + return this; + } else { + this.updateParameters.withCreateMode(createMode); + return this; + } + } + + public ManagedDatabaseImpl withStorageContainerUri(String storageContainerUri) { + if (isInCreateMode()) { + this.innerModel().withStorageContainerUri(storageContainerUri); + return this; + } else { + this.updateParameters.withStorageContainerUri(storageContainerUri); + return this; + } + } + + public ManagedDatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.innerModel().withSourceDatabaseId(sourceDatabaseId); + return this; + } else { + this.updateParameters.withSourceDatabaseId(sourceDatabaseId); + return this; + } + } + + public ManagedDatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.innerModel().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } else { + this.updateParameters.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + } + + public ManagedDatabaseImpl withStorageContainerSasToken(String storageContainerSasToken) { + if (isInCreateMode()) { + this.innerModel().withStorageContainerSasToken(storageContainerSasToken); + return this; + } else { + this.updateParameters.withStorageContainerSasToken(storageContainerSasToken); + return this; + } + } + + public ManagedDatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.innerModel().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } else { + this.updateParameters.withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + } + + public ManagedDatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (isInCreateMode()) { + this.innerModel().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } else { + this.updateParameters.withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + } + + public ManagedDatabaseImpl withAutoCompleteRestore(Boolean autoCompleteRestore) { + this.innerModel().withAutoCompleteRestore(autoCompleteRestore); + return this; + } + + public ManagedDatabaseImpl withLastBackupName(String lastBackupName) { + if (isInCreateMode()) { + this.innerModel().withLastBackupName(lastBackupName); + return this; + } else { + this.updateParameters.withLastBackupName(lastBackupName); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.java new file mode 100644 index 0000000000000..ed17a177b1175 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.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.sql.generated.fluent.ManagedDatabaseRestoreDetailsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseRestoreDetailsClient. */ +public final class ManagedDatabaseRestoreDetailsClientImpl implements ManagedDatabaseRestoreDetailsClient { + private final ClientLogger logger = new ClientLogger(ManagedDatabaseRestoreDetailsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseRestoreDetailsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseRestoreDetailsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseRestoreDetailsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseRestoreDetailsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseRestoreDetails to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseRestoreDetailsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails" + + "/{restoreDetailsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("restoreDetailsName") RestoreDetailsName restoreDetailsName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restoreDetailsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restoreDetailsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + restoreDetailsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @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 managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restoreDetailsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restoreDetailsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + restoreDetailsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseRestoreDetailsResultInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName).block(); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @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 managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.java new file mode 100644 index 0000000000000..f231fcf10f998 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRestoreDetailsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetails; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsResult; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedDatabaseRestoreDetailsImpl implements ManagedDatabaseRestoreDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseRestoreDetailsImpl.class); + + private final ManagedDatabaseRestoreDetailsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseRestoreDetailsImpl( + ManagedDatabaseRestoreDetailsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedDatabaseRestoreDetailsResult get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + ManagedDatabaseRestoreDetailsResultInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName); + if (inner != null) { + return new ManagedDatabaseRestoreDetailsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseRestoreDetailsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ManagedDatabaseRestoreDetailsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsResultImpl.java new file mode 100644 index 0000000000000..b93ae8f5b44fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsResultImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsResult; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ManagedDatabaseRestoreDetailsResultImpl implements ManagedDatabaseRestoreDetailsResult { + private ManagedDatabaseRestoreDetailsResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedDatabaseRestoreDetailsResultImpl( + ManagedDatabaseRestoreDetailsResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String status() { + return this.innerModel().status(); + } + + public String currentRestoringFileName() { + return this.innerModel().currentRestoringFileName(); + } + + public String lastRestoredFileName() { + return this.innerModel().lastRestoredFileName(); + } + + public OffsetDateTime lastRestoredFileTime() { + return this.innerModel().lastRestoredFileTime(); + } + + public Double percentCompleted() { + return this.innerModel().percentCompleted(); + } + + public List unrestorableFiles() { + List inner = this.innerModel().unrestorableFiles(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Long numberOfFilesDetected() { + return this.innerModel().numberOfFilesDetected(); + } + + public String lastUploadedFileName() { + return this.innerModel().lastUploadedFileName(); + } + + public OffsetDateTime lastUploadedFileTime() { + return this.innerModel().lastUploadedFileTime(); + } + + public String blockReason() { + return this.innerModel().blockReason(); + } + + public ManagedDatabaseRestoreDetailsResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..2daeb2dd2b65c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,858 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.sql.generated.fluent.ManagedDatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseSecurityAlertPoliciesClient. + */ +public final class ManagedDatabaseSecurityAlertPoliciesClientImpl + implements ManagedDatabaseSecurityAlertPoliciesClient { + private final ClientLogger logger = new ClientLogger(ManagedDatabaseSecurityAlertPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseSecurityAlertPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSecurityAlertPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies" + + "/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies" + + "/{securityAlertPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName).block(); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context) + .block(); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @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 managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, parameters) + .block(); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @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 managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, parameters, context) + .block(); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @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 managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @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 managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @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 managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, 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 the managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 the managed database's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..fdf1afa9d69b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.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.sql.generated.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.sql.generated.fluent.ManagedDatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedDatabaseSecurityAlertPoliciesImpl implements ManagedDatabaseSecurityAlertPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseSecurityAlertPoliciesImpl.class); + + private final ManagedDatabaseSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSecurityAlertPoliciesImpl( + ManagedDatabaseSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedDatabaseSecurityAlertPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + ManagedDatabaseSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName); + if (inner != null) { + return new ManagedDatabaseSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public ManagedDatabaseSecurityAlertPolicy 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context); + } + + private ManagedDatabaseSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedDatabaseSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ManagedDatabaseSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..b5419c8096f42 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ManagedDatabaseSecurityAlertPolicyImpl + implements ManagedDatabaseSecurityAlertPolicy, + ManagedDatabaseSecurityAlertPolicy.Definition, + ManagedDatabaseSecurityAlertPolicy.Update { + private ManagedDatabaseSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public ManagedDatabaseSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public ManagedDatabaseSecurityAlertPolicyImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedDatabaseSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + context) + .getValue(); + return this; + } + + ManagedDatabaseSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedDatabaseSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ManagedDatabaseSecurityAlertPolicyImpl update() { + return this; + } + + public ManagedDatabaseSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + context) + .getValue(); + return this; + } + + ManagedDatabaseSecurityAlertPolicyImpl( + ManagedDatabaseSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ManagedDatabaseSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..a81d577e373d0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java @@ -0,0 +1,2203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelListResult; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedDatabaseSensitivityLabelsClient. + */ +public final class ManagedDatabaseSensitivityLabelsClientImpl implements ManagedDatabaseSensitivityLabelsClient { + private final ClientLogger logger = new ClientLogger(ManagedDatabaseSensitivityLabelsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseSensitivityLabelsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSensitivityLabels to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseSensitivityLabelsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") SensitivityLabelSource sensitivityLabelSource, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SensitivityLabelInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCurrentByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRecommendedByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("includeDisabledRecommendations") Boolean includeDisabledRecommendations, + @QueryParam("$skipToken") String skipToken, + @QueryParam("$filter") String filter, + @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> listCurrentByDatabaseNext( + @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> listRecommendedByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource) + .block(); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + return getWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context) + .block(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters) + .block(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + parameters, + context) + .block(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + deleteAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).block(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> disableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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> disableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 disableRecommendationAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return disableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + disableRecommendationAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .block(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return disableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> enableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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> enableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 enableRecommendationAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return enableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + enableRecommendationAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .block(); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return enableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter) { + return new PagedFlux<>( + () -> listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + return new PagedFlux<>( + () -> listCurrentByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, filter, context), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final Boolean includeDisabledRecommendations = null; + final String skipToken = null; + final String filter = null; + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + context), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final Boolean includeDisabledRecommendations = null; + final String skipToken = null; + final String filter = null; + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context) { + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + 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 sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync(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.listCurrentByDatabaseNext(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 sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync( + 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 + .listCurrentByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync(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.listRecommendedByDatabaseNext(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 sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync( + 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 + .listRecommendedByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..d256ea7ec2472 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedDatabaseSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedDatabaseSensitivityLabelsImpl implements ManagedDatabaseSensitivityLabels { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseSensitivityLabelsImpl.class); + + private final ManagedDatabaseSensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSensitivityLabelsImpl( + ManagedDatabaseSensitivityLabelsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SensitivityLabel get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + SensitivityLabelInner inner = + this + .serviceClient() + .get( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SensitivityLabelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SensitivityLabel createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + SensitivityLabelInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + parameters); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SensitivityLabelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .delete(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .disableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .disableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .enableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .enableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listCurrentByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + PagedIterable inner = + this + .serviceClient() + .listCurrentByDatabase(resourceGroupName, managedInstanceName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listRecommendedByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listRecommendedByDatabase( + resourceGroupName, + managedInstanceName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + private ManagedDatabaseSensitivityLabelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java new file mode 100644 index 0000000000000..67d362562a156 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java @@ -0,0 +1,938 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.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.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl + implements ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { + private final ClientLogger logger = + new ClientLogger(ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * SqlManagementClientManagedDatabaseVulnerabilityAssessmentRuleBaselines to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .block(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return getWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context) + .block(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters) + .block(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + context) + .block(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .block(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..23bc7a5534a3d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl + implements ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.class); + + private final ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl( + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .get( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessmentRuleBaseline createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + DatabaseVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + this + .serviceClient() + .delete( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + } + + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 0000000000000..a0279df07a03c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,1314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecordListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentScansClient. + */ +public final class ManagedDatabaseVulnerabilityAssessmentScansClientImpl + implements ManagedDatabaseVulnerabilityAssessmentScansClient { + private final ClientLogger logger = new ClientLogger(ManagedDatabaseVulnerabilityAssessmentScansClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseVulnerabilityAssessmentScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseVulnerabilityAssessmentScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseVulnerabilityAssessmentScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseVulnerabilityAssessmentScans to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseVulnerabilityAssessmentScansService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans/{scanId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> initiateScan( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans/{scanId}/export") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> export( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + 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 the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName)); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context)); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .block(); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> initiateScanWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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>> initiateScanWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .getSyncPoller(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .getSyncPoller(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 initiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + initiateScanAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .block(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + initiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .export( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .export( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .block(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @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 database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return exportWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 vulnerability assessment scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..bab7a3ed3ae0f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.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.sql.generated.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.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScansExport; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecord; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedDatabaseVulnerabilityAssessmentScansImpl + implements ManagedDatabaseVulnerabilityAssessmentScans { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedDatabaseVulnerabilityAssessmentScansImpl.class); + + private final ManagedDatabaseVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseVulnerabilityAssessmentScansImpl( + ManagedDatabaseVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + VulnerabilityAssessmentScanRecordInner inner = + this + .serviceClient() + .get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new VulnerabilityAssessmentScanRecordImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VulnerabilityAssessmentScanRecordImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + this + .serviceClient() + .initiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + } + + public void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + this + .serviceClient() + .initiateScan( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + } + + public DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + DatabaseVulnerabilityAssessmentScansExportInner inner = + this + .serviceClient() + .export(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .exportWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentScansExportImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ManagedDatabaseVulnerabilityAssessmentScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..8ba101365b5d9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,1080 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentsClient. + */ +public final class ManagedDatabaseVulnerabilityAssessmentsClientImpl + implements ManagedDatabaseVulnerabilityAssessmentsClient { + private final ClientLogger logger = new ClientLogger(ManagedDatabaseVulnerabilityAssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseVulnerabilityAssessments to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName).block(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters) + .block(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName).block(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + 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 the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, 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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 the database's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..6e8bcaa53a243 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedDatabaseVulnerabilityAssessmentsImpl implements ManagedDatabaseVulnerabilityAssessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseVulnerabilityAssessmentsImpl.class); + + private final ManagedDatabaseVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseVulnerabilityAssessmentsImpl( + ManagedDatabaseVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + DatabaseVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessment createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + DatabaseVulnerabilityAssessmentInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + private ManagedDatabaseVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java new file mode 100644 index 0000000000000..ccb8dc2015c12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java @@ -0,0 +1,2131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabasesClient. */ +public final class ManagedDatabasesClientImpl implements ManagedDatabasesClient { + private final ClientLogger logger = new ClientLogger(ManagedDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ManagedDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabases to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/completeRestore") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> completeRestore( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CompleteDatabaseRestoreDefinition parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/inaccessibleManagedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listInaccessibleByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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> listByInstanceNext( + @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> listInaccessibleByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync(String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName).block(); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, context).block(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedDatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedDatabaseInner.class, + ManagedDatabaseInner.class, + Context.NONE); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedDatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedDatabaseInner.class, ManagedDatabaseInner.class, context); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, String databaseName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managedInstanceName, String databaseName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName).getSyncPoller(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, String databaseName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName, String databaseName) { + deleteAsync(resourceGroupName, managedInstanceName, databaseName).block(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, databaseName, context).block(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedDatabaseInner> beginUpdateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedDatabaseInner.class, + ManagedDatabaseInner.class, + Context.NONE); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedDatabaseInner> beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedDatabaseInner.class, ManagedDatabaseInner.class, context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).getSyncPoller(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner update( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @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 managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> completeRestoreWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + return FluxUtil + .withContext( + context -> + service + .completeRestore( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @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>> completeRestoreWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2020-02-02-preview"; + context = this.client.mergeContext(context); + return service + .completeRestore( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCompleteRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + Mono>> mono = + completeRestoreWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCompleteRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + completeRestoreWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .getSyncPoller(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completeRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @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 completeRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + completeRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + completeRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listInaccessibleByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInaccessibleByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listInaccessibleByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listInaccessibleByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listInaccessibleByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listInaccessibleByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listInaccessibleByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 inaccessible managed databases in a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listInaccessibleByInstanceAsync(resourceGroupName, managedInstanceName, 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 managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(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.listByInstanceNext(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 managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceNextSinglePageAsync(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.listInaccessibleByInstanceNext(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 managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceNextSinglePageAsync( + 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 + .listInaccessibleByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.java new file mode 100644 index 0000000000000..434d89722aab9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedDatabasesImpl implements ManagedDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabasesImpl.class); + + private final ManagedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabasesImpl( + ManagedDatabasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public ManagedDatabase get(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName); + if (inner != null) { + return new ManagedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String databaseName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, databaseName); + } + + public void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, databaseName, context); + } + + public void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + this.serviceClient().completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + this.serviceClient().completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listInaccessibleByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listInaccessibleByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public ManagedDatabase 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, databaseName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, databaseName, context); + } + + private ManagedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedDatabaseImpl define(String name) { + return new ManagedDatabaseImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.java new file mode 100644 index 0000000000000..a952bc9ac5498 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import java.util.UUID; + +public final class ManagedInstanceAdministratorImpl + implements ManagedInstanceAdministrator, + ManagedInstanceAdministrator.Definition, + ManagedInstanceAdministrator.Update { + private ManagedInstanceAdministratorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ManagedInstanceAdministratorType administratorType() { + return this.innerModel().administratorType(); + } + + public String login() { + return this.innerModel().login(); + } + + public UUID sid() { + return this.innerModel().sid(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public ManagedInstanceAdministratorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + public ManagedInstanceAdministratorImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceAdministrator create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAdministrator create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), context); + return this; + } + + ManagedInstanceAdministratorImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceAdministratorInner(); + this.serviceManager = serviceManager; + } + + public ManagedInstanceAdministratorImpl update() { + return this; + } + + public ManagedInstanceAdministrator apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAdministrator apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), context); + return this; + } + + ManagedInstanceAdministratorImpl( + ManagedInstanceAdministratorInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + } + + public ManagedInstanceAdministrator refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .getWithResponse(resourceGroupName, managedInstanceName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceAdministrator refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .getWithResponse(resourceGroupName, managedInstanceName, context) + .getValue(); + return this; + } + + public ManagedInstanceAdministratorImpl withAdministratorType(ManagedInstanceAdministratorType administratorType) { + this.innerModel().withAdministratorType(administratorType); + return this; + } + + public ManagedInstanceAdministratorImpl withLogin(String login) { + this.innerModel().withLogin(login); + return this; + } + + public ManagedInstanceAdministratorImpl withSid(UUID sid) { + this.innerModel().withSid(sid); + return this; + } + + public ManagedInstanceAdministratorImpl withTenantId(UUID tenantId) { + this.innerModel().withTenantId(tenantId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java new file mode 100644 index 0000000000000..3ce12c72409e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java @@ -0,0 +1,1125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceAdministratorsClient. */ +public final class ManagedInstanceAdministratorsClientImpl implements ManagedInstanceAdministratorsClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceAdministratorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceAdministratorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceAdministratorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceAdministratorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceAdministratorsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceAdministrators to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceAdministratorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/administrators") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/administrators/{administratorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("administratorName") String administratorName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/administrators/{administratorName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("administratorName") String administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceAdministratorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/administrators/{administratorName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("administratorName") String administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 administratorName = "ActiveDirectory"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 administratorName = "ActiveDirectory"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String managedInstanceName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdministratorInner get(String resourceGroupName, String managedInstanceName) { + return getAsync(resourceGroupName, managedInstanceName).block(); + } + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, context).block(); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceAdministratorInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 administratorName = "ActiveDirectory"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + ManagedInstanceAdministratorInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 administratorName = "ActiveDirectory"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceAdministratorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAdministratorInner.class, + ManagedInstanceAdministratorInner.class, + Context.NONE); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + ManagedInstanceAdministratorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAdministratorInner.class, + ManagedInstanceAdministratorInner.class, + context); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceAdministratorInner> + beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceAdministratorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceAdministratorInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * Creates or updates a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 administratorName = "ActiveDirectory"; + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 administratorName = "ActiveDirectory"; + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String managedInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, managedInstanceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String managedInstanceName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName).getSyncPoller(); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, context).getSyncPoller(); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName) { + deleteAsync(resourceGroupName, managedInstanceName).block(); + } + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(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.listByInstanceNext(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 managed instance administrators. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.java new file mode 100644 index 0000000000000..186b2b5bca7b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrators; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstanceAdministratorsImpl implements ManagedInstanceAdministrators { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceAdministratorsImpl.class); + + private final ManagedInstanceAdministratorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceAdministratorsImpl( + ManagedInstanceAdministratorsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAdministratorImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAdministratorImpl(inner1, this.manager())); + } + + public ManagedInstanceAdministrator get(String resourceGroupName, String managedInstanceName) { + ManagedInstanceAdministratorInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName); + if (inner != null) { + return new ManagedInstanceAdministratorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceAdministratorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String managedInstanceName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName); + } + + public void delete(String resourceGroupName, String managedInstanceName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, context); + } + + public ManagedInstanceAdministrator 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, context); + } + + private ManagedInstanceAdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceAdministratorImpl define() { + return new ManagedInstanceAdministratorImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationImpl.java new file mode 100644 index 0000000000000..1e7019ea27e91 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentication; + +public final class ManagedInstanceAzureADOnlyAuthenticationImpl + implements ManagedInstanceAzureADOnlyAuthentication, + ManagedInstanceAzureADOnlyAuthentication.Definition, + ManagedInstanceAzureADOnlyAuthentication.Update { + private ManagedInstanceAzureADOnlyAuthenticationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean azureADOnlyAuthentication() { + return this.innerModel().azureADOnlyAuthentication(); + } + + public ManagedInstanceAzureADOnlyAuthenticationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private AuthenticationName authenticationName; + + public ManagedInstanceAzureADOnlyAuthenticationImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate( + resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), context); + return this; + } + + ManagedInstanceAzureADOnlyAuthenticationImpl( + AuthenticationName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceAzureADOnlyAuthenticationInner(); + this.serviceManager = serviceManager; + this.authenticationName = name; + } + + public ManagedInstanceAzureADOnlyAuthenticationImpl update() { + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate( + resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), context); + return this; + } + + ManagedInstanceAzureADOnlyAuthenticationImpl( + ManagedInstanceAzureADOnlyAuthenticationInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(innerObject.id(), "azureADOnlyAuthentications")); + } + + public ManagedInstanceAzureADOnlyAuthentication refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, managedInstanceName, authenticationName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, managedInstanceName, authenticationName, context) + .getValue(); + return this; + } + + public ManagedInstanceAzureADOnlyAuthenticationImpl withAzureADOnlyAuthentication( + Boolean azureADOnlyAuthentication) { + this.innerModel().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java new file mode 100644 index 0000000000000..143d5677f9ee3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java @@ -0,0 +1,1230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceAzureADOnlyAuthenticationsClient. + */ +public final class ManagedInstanceAzureADOnlyAuthenticationsClientImpl + implements ManagedInstanceAzureADOnlyAuthenticationsClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceAzureADOnlyAuthenticationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceAzureADOnlyAuthenticationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceAzureADOnlyAuthenticationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceAzureADOnlyAuthenticationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceAzureADOnlyAuthenticationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceAzureADOnlyAuthentications to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceAzureADOnlyAuthenticationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceAzureADOnlyAuthenticationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAzureADOnlyAuthenticationInner get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + return getAsync(resourceGroupName, managedInstanceName, authenticationName).block(); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName, context).block(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAzureADOnlyAuthenticationInner.class, + ManagedInstanceAzureADOnlyAuthenticationInner.class, + Context.NONE); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, authenticationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAzureADOnlyAuthenticationInner.class, + ManagedInstanceAzureADOnlyAuthenticationInner.class, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters) + .getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters).block(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters, context) + .block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, AuthenticationName authenticationName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 managedInstanceName, AuthenticationName authenticationName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName, context).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName, AuthenticationName authenticationName) { + deleteAsync(resourceGroupName, managedInstanceName, authenticationName).block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, authenticationName, context).block(); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, 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 active directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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.listByInstanceNext(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 active directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java new file mode 100644 index 0000000000000..1f80487b649f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentication; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentications; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstanceAzureADOnlyAuthenticationsImpl implements ManagedInstanceAzureADOnlyAuthentications { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceAzureADOnlyAuthenticationsImpl.class); + + private final ManagedInstanceAzureADOnlyAuthenticationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceAzureADOnlyAuthenticationsImpl( + ManagedInstanceAzureADOnlyAuthenticationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedInstanceAzureADOnlyAuthentication get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + ManagedInstanceAzureADOnlyAuthenticationInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, authenticationName); + if (inner != null) { + return new ManagedInstanceAzureADOnlyAuthenticationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, authenticationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceAzureADOnlyAuthenticationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, authenticationName); + } + + public void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, authenticationName, context); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public ManagedInstanceAzureADOnlyAuthentication 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, authenticationName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, authenticationName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, authenticationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, authenticationName, context); + } + + private ManagedInstanceAzureADOnlyAuthenticationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceAzureADOnlyAuthenticationImpl define(AuthenticationName name) { + return new ManagedInstanceAzureADOnlyAuthenticationImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.java new file mode 100644 index 0000000000000..126545cab87cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +public final class ManagedInstanceEncryptionProtectorImpl + implements ManagedInstanceEncryptionProtector, + ManagedInstanceEncryptionProtector.Definition, + ManagedInstanceEncryptionProtector.Update { + private ManagedInstanceEncryptionProtectorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String serverKeyName() { + return this.innerModel().serverKeyName(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public ManagedInstanceEncryptionProtectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private EncryptionProtectorName encryptionProtectorName; + + public ManagedInstanceEncryptionProtectorImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceEncryptionProtector create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceEncryptionProtector create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + ManagedInstanceEncryptionProtectorImpl( + EncryptionProtectorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceEncryptionProtectorInner(); + this.serviceManager = serviceManager; + this.encryptionProtectorName = name; + } + + public ManagedInstanceEncryptionProtectorImpl update() { + return this; + } + + public ManagedInstanceEncryptionProtector apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceEncryptionProtector apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + ManagedInstanceEncryptionProtectorImpl( + ManagedInstanceEncryptionProtectorInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "encryptionProtector")); + } + + public ManagedInstanceEncryptionProtector refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceEncryptionProtector refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, context) + .getValue(); + return this; + } + + public ManagedInstanceEncryptionProtectorImpl withServerKeyName(String serverKeyName) { + this.innerModel().withServerKeyName(serverKeyName); + return this; + } + + public ManagedInstanceEncryptionProtectorImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java new file mode 100644 index 0000000000000..09e7c6d65bbb4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java @@ -0,0 +1,1236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceEncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtectorListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstanceEncryptionProtectorsClient. + */ +public final class ManagedInstanceEncryptionProtectorsClientImpl implements ManagedInstanceEncryptionProtectorsClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceEncryptionProtectorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceEncryptionProtectorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceEncryptionProtectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceEncryptionProtectorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceEncryptionProtectorsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceEncryptionProtectors to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceEncryptionProtectorsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> revalidate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceEncryptionProtectorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName).getSyncPoller(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context) + .getSyncPoller(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + revalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName).block(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + revalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context).block(); + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceEncryptionProtectorInner get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return getAsync(resourceGroupName, managedInstanceName, encryptionProtectorName).block(); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context).block(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceEncryptionProtectorInner.class, + ManagedInstanceEncryptionProtectorInner.class, + Context.NONE); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceEncryptionProtectorInner.class, + ManagedInstanceEncryptionProtectorInner.class, + context); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters) + .getSyncPoller(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters).block(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @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 managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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.listByInstanceNext(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 managed instance encryption protectors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..bfe7197ecffb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceEncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtectors; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstanceEncryptionProtectorsImpl implements ManagedInstanceEncryptionProtectors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceEncryptionProtectorsImpl.class); + + private final ManagedInstanceEncryptionProtectorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceEncryptionProtectorsImpl( + ManagedInstanceEncryptionProtectorsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + this.serviceClient().revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName); + } + + public void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + this.serviceClient().revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceEncryptionProtectorImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceEncryptionProtectorImpl(inner1, this.manager())); + } + + public ManagedInstanceEncryptionProtector get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + ManagedInstanceEncryptionProtectorInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, encryptionProtectorName); + if (inner != null) { + return new ManagedInstanceEncryptionProtectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceEncryptionProtectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceEncryptionProtector 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(id, "encryptionProtector")); + if (encryptionProtectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(id, "encryptionProtector")); + if (encryptionProtectorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + } + + private ManagedInstanceEncryptionProtectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceEncryptionProtectorImpl define(EncryptionProtectorName name) { + return new ManagedInstanceEncryptionProtectorImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java new file mode 100644 index 0000000000000..2674c6f5bffe0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePecProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePropertiesProvisioningState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceUpdate; +import com.azure.resourcemanager.sql.generated.models.ManagedServerCreateMode; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.azure.resourcemanager.sql.generated.models.StorageAccountType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ManagedInstanceImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { + private ManagedInstanceInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 ResourceIdentity identity() { + return this.innerModel().identity(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.innerModel().managedInstanceCreateMode(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public String administratorLoginPassword() { + return this.innerModel().administratorLoginPassword(); + } + + public String subnetId() { + return this.innerModel().subnetId(); + } + + public String state() { + return this.innerModel().state(); + } + + public ManagedInstanceLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public Integer vCores() { + return this.innerModel().vCores(); + } + + public Integer storageSizeInGB() { + return this.innerModel().storageSizeInGB(); + } + + public String collation() { + return this.innerModel().collation(); + } + + public String dnsZone() { + return this.innerModel().dnsZone(); + } + + public String dnsZonePartner() { + return this.innerModel().dnsZonePartner(); + } + + public Boolean publicDataEndpointEnabled() { + return this.innerModel().publicDataEndpointEnabled(); + } + + public String sourceManagedInstanceId() { + return this.innerModel().sourceManagedInstanceId(); + } + + public OffsetDateTime restorePointInTime() { + return this.innerModel().restorePointInTime(); + } + + public ManagedInstanceProxyOverride proxyOverride() { + return this.innerModel().proxyOverride(); + } + + public String timezoneId() { + return this.innerModel().timezoneId(); + } + + public String instancePoolId() { + return this.innerModel().instancePoolId(); + } + + public String maintenanceConfigurationId() { + return this.innerModel().maintenanceConfigurationId(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); + } + + public StorageAccountType storageAccountType() { + return this.innerModel().storageAccountType(); + } + + public Boolean zoneRedundant() { + return this.innerModel().zoneRedundant(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ManagedInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private ManagedInstanceUpdate updateParameters; + + public ManagedInstanceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ManagedInstance create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstance create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), context); + return this; + } + + ManagedInstanceImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceInner(); + this.serviceManager = serviceManager; + this.managedInstanceName = name; + } + + public ManagedInstanceImpl update() { + this.updateParameters = new ManagedInstanceUpdate(); + return this; + } + + public ManagedInstance apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .update(resourceGroupName, managedInstanceName, updateParameters, Context.NONE); + return this; + } + + public ManagedInstance apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .update(resourceGroupName, managedInstanceName, updateParameters, context); + return this; + } + + ManagedInstanceImpl( + ManagedInstanceInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + } + + public ManagedInstance refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstance refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, context) + .getValue(); + return this; + } + + public ManagedInstanceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedInstanceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedInstanceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ManagedInstanceImpl withIdentity(ResourceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ManagedInstanceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public ManagedInstanceImpl withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + if (isInCreateMode()) { + this.innerModel().withManagedInstanceCreateMode(managedInstanceCreateMode); + return this; + } else { + this.updateParameters.withManagedInstanceCreateMode(managedInstanceCreateMode); + return this; + } + } + + public ManagedInstanceImpl withAdministratorLogin(String administratorLogin) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLogin(administratorLogin); + return this; + } else { + this.updateParameters.withAdministratorLogin(administratorLogin); + return this; + } + } + + public ManagedInstanceImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } else { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + } + + public ManagedInstanceImpl withSubnetId(String subnetId) { + if (isInCreateMode()) { + this.innerModel().withSubnetId(subnetId); + return this; + } else { + this.updateParameters.withSubnetId(subnetId); + return this; + } + } + + public ManagedInstanceImpl withLicenseType(ManagedInstanceLicenseType licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + public ManagedInstanceImpl withVCores(Integer vCores) { + if (isInCreateMode()) { + this.innerModel().withVCores(vCores); + return this; + } else { + this.updateParameters.withVCores(vCores); + return this; + } + } + + public ManagedInstanceImpl withStorageSizeInGB(Integer storageSizeInGB) { + if (isInCreateMode()) { + this.innerModel().withStorageSizeInGB(storageSizeInGB); + return this; + } else { + this.updateParameters.withStorageSizeInGB(storageSizeInGB); + return this; + } + } + + public ManagedInstanceImpl withCollation(String collation) { + if (isInCreateMode()) { + this.innerModel().withCollation(collation); + return this; + } else { + this.updateParameters.withCollation(collation); + return this; + } + } + + public ManagedInstanceImpl withDnsZonePartner(String dnsZonePartner) { + if (isInCreateMode()) { + this.innerModel().withDnsZonePartner(dnsZonePartner); + return this; + } else { + this.updateParameters.withDnsZonePartner(dnsZonePartner); + return this; + } + } + + public ManagedInstanceImpl withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + if (isInCreateMode()) { + this.innerModel().withPublicDataEndpointEnabled(publicDataEndpointEnabled); + return this; + } else { + this.updateParameters.withPublicDataEndpointEnabled(publicDataEndpointEnabled); + return this; + } + } + + public ManagedInstanceImpl withSourceManagedInstanceId(String sourceManagedInstanceId) { + if (isInCreateMode()) { + this.innerModel().withSourceManagedInstanceId(sourceManagedInstanceId); + return this; + } else { + this.updateParameters.withSourceManagedInstanceId(sourceManagedInstanceId); + return this; + } + } + + public ManagedInstanceImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + if (isInCreateMode()) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } else { + this.updateParameters.withRestorePointInTime(restorePointInTime); + return this; + } + } + + public ManagedInstanceImpl withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + if (isInCreateMode()) { + this.innerModel().withProxyOverride(proxyOverride); + return this; + } else { + this.updateParameters.withProxyOverride(proxyOverride); + return this; + } + } + + public ManagedInstanceImpl withTimezoneId(String timezoneId) { + if (isInCreateMode()) { + this.innerModel().withTimezoneId(timezoneId); + return this; + } else { + this.updateParameters.withTimezoneId(timezoneId); + return this; + } + } + + public ManagedInstanceImpl withInstancePoolId(String instancePoolId) { + if (isInCreateMode()) { + this.innerModel().withInstancePoolId(instancePoolId); + return this; + } else { + this.updateParameters.withInstancePoolId(instancePoolId); + return this; + } + } + + public ManagedInstanceImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } else { + this.updateParameters.withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + } + + public ManagedInstanceImpl withMinimalTlsVersion(String minimalTlsVersion) { + if (isInCreateMode()) { + this.innerModel().withMinimalTlsVersion(minimalTlsVersion); + return this; + } else { + this.updateParameters.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + } + + public ManagedInstanceImpl withStorageAccountType(StorageAccountType storageAccountType) { + if (isInCreateMode()) { + this.innerModel().withStorageAccountType(storageAccountType); + return this; + } else { + this.updateParameters.withStorageAccountType(storageAccountType); + return this; + } + } + + public ManagedInstanceImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.innerModel().withZoneRedundant(zoneRedundant); + return this; + } else { + this.updateParameters.withZoneRedundant(zoneRedundant); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.java new file mode 100644 index 0000000000000..1094417ce89ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKey; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import java.time.OffsetDateTime; + +public final class ManagedInstanceKeyImpl + implements ManagedInstanceKey, ManagedInstanceKey.Definition, ManagedInstanceKey.Update { + private ManagedInstanceKeyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public ManagedInstanceKeyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String keyName; + + public ManagedInstanceKeyImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceKey create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceKey create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), context); + return this; + } + + ManagedInstanceKeyImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceKeyInner(); + this.serviceManager = serviceManager; + this.keyName = name; + } + + public ManagedInstanceKeyImpl update() { + return this; + } + + public ManagedInstanceKey apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceKey apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), context); + return this; + } + + ManagedInstanceKeyImpl( + ManagedInstanceKeyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.keyName = Utils.getValueFromIdByName(innerObject.id(), "keys"); + } + + public ManagedInstanceKey refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .getWithResponse(resourceGroupName, managedInstanceName, keyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceKey refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .getWithResponse(resourceGroupName, managedInstanceName, keyName, context) + .getValue(); + return this; + } + + public ManagedInstanceKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ManagedInstanceKeyImpl withUri(String uri) { + this.innerModel().withUri(uri); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java new file mode 100644 index 0000000000000..4e0b2b99e02bc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java @@ -0,0 +1,1193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKeyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceKeysClient. */ +public final class ManagedInstanceKeysClientImpl implements ManagedInstanceKeysClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceKeysClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceKeysService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceKeysClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ManagedInstanceKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceKeys to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceKeysService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/keys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("$filter") String filter, + @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.Sql" + + "/managedInstances/{managedInstanceName}/keys/{keyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("keyName") String keyName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/keys/{keyName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceKeyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/keys/{keyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, String filter) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param filter An OData filter expression that filters elements in the collection. + * @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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, String filter, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, String filter) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + final String filter = null; + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param filter An OData filter expression that filters elements in the collection. + * @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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, String filter, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + final String filter = null; + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, filter)); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param filter An OData filter expression that filters elements in the collection. + * @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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, filter, context)); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String keyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, keyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceKeyInner get(String resourceGroupName, String managedInstanceName, String keyName) { + return getAsync(resourceGroupName, managedInstanceName, keyName).block(); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, keyName, context).block(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceKeyInner.class, + ManagedInstanceKeyInner.class, + Context.NONE); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceKeyInner.class, + ManagedInstanceKeyInner.class, + context); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters).block(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @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 managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters, context).block(); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, String keyName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @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 managedInstanceName, String keyName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String keyName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, keyName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, keyName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName).getSyncPoller(); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName, context).getSyncPoller(); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, String keyName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName, String keyName) { + deleteAsync(resourceGroupName, managedInstanceName, keyName).block(); + } + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, keyName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(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.listByInstanceNext(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 managed instance keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.java new file mode 100644 index 0000000000000..9d37faf48c3d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKey; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKeys; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstanceKeysImpl implements ManagedInstanceKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceKeysImpl.class); + + private final ManagedInstanceKeysClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceKeysImpl( + ManagedInstanceKeysClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceKeyImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, filter, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceKeyImpl(inner1, this.manager())); + } + + public ManagedInstanceKey get(String resourceGroupName, String managedInstanceName, String keyName) { + ManagedInstanceKeyInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName, keyName); + if (inner != null) { + return new ManagedInstanceKeyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, keyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String keyName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, keyName); + } + + public void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, keyName, context); + } + + public ManagedInstanceKey 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, keyName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, keyName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, keyName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, keyName, context); + } + + private ManagedInstanceKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceKeyImpl define(String name) { + return new ManagedInstanceKeyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.java new file mode 100644 index 0000000000000..f888e6e6a33ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionBackup; +import java.time.OffsetDateTime; + +public final class ManagedInstanceLongTermRetentionBackupImpl implements ManagedInstanceLongTermRetentionBackup { + private ManagedInstanceLongTermRetentionBackupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstanceLongTermRetentionBackupImpl( + ManagedInstanceLongTermRetentionBackupInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String managedInstanceName() { + return this.innerModel().managedInstanceName(); + } + + public OffsetDateTime managedInstanceCreateTime() { + return this.innerModel().managedInstanceCreateTime(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime databaseDeletionTime() { + return this.innerModel().databaseDeletionTime(); + } + + public OffsetDateTime backupTime() { + return this.innerModel().backupTime(); + } + + public OffsetDateTime backupExpirationTime() { + return this.innerModel().backupExpirationTime(); + } + + public ManagedInstanceLongTermRetentionBackupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..d07b54039bcee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1006 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceLongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceLongTermRetentionPoliciesClient. + */ +public final class ManagedInstanceLongTermRetentionPoliciesClientImpl + implements ManagedInstanceLongTermRetentionPoliciesClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceLongTermRetentionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceLongTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceLongTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceLongTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceLongTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceLongTermRetentionPolicies to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceLongTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedInstanceLongTermRetentionPolicyName policyName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedInstanceLongTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceLongTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, policyName).block(); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName, context).block(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceLongTermRetentionPolicyInner.class, + ManagedInstanceLongTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceLongTermRetentionPolicyInner.class, + ManagedInstanceLongTermRetentionPolicyInner.class, + context); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .block(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @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 long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, 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 long term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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.listByDatabaseNext(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 long term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..076b70dc952cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceLongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstanceLongTermRetentionPoliciesImpl implements ManagedInstanceLongTermRetentionPolicies { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceLongTermRetentionPoliciesImpl.class); + + private final ManagedInstanceLongTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceLongTermRetentionPoliciesImpl( + ManagedInstanceLongTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedInstanceLongTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + ManagedInstanceLongTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, policyName); + if (inner != null) { + return new ManagedInstanceLongTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceLongTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public ManagedInstanceLongTermRetentionPolicy 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + ManagedInstanceLongTermRetentionPolicyName policyName = + ManagedInstanceLongTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + ManagedInstanceLongTermRetentionPolicyName policyName = + ManagedInstanceLongTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies")); + if (policyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + } + + private ManagedInstanceLongTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceLongTermRetentionPolicyImpl define(ManagedInstanceLongTermRetentionPolicyName name) { + return new ManagedInstanceLongTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..e75bc8dcb4b2a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPolicyImpl.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.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +public final class ManagedInstanceLongTermRetentionPolicyImpl + implements ManagedInstanceLongTermRetentionPolicy, + ManagedInstanceLongTermRetentionPolicy.Definition, + ManagedInstanceLongTermRetentionPolicy.Update { + private ManagedInstanceLongTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String weeklyRetention() { + return this.innerModel().weeklyRetention(); + } + + public String monthlyRetention() { + return this.innerModel().monthlyRetention(); + } + + public String yearlyRetention() { + return this.innerModel().yearlyRetention(); + } + + public Integer weekOfYear() { + return this.innerModel().weekOfYear(); + } + + public ManagedInstanceLongTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private ManagedInstanceLongTermRetentionPolicyName policyName; + + public ManagedInstanceLongTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedInstanceLongTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceLongTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedInstanceLongTermRetentionPolicyImpl( + ManagedInstanceLongTermRetentionPolicyName name, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceLongTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public ManagedInstanceLongTermRetentionPolicyImpl update() { + return this; + } + + public ManagedInstanceLongTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceLongTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedInstanceLongTermRetentionPolicyImpl( + ManagedInstanceLongTermRetentionPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + ManagedInstanceLongTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupLongTermRetentionPolicies")); + } + + public ManagedInstanceLongTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceLongTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context) + .getValue(); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withWeeklyRetention(String weeklyRetention) { + this.innerModel().withWeeklyRetention(weeklyRetention); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withMonthlyRetention(String monthlyRetention) { + this.innerModel().withMonthlyRetention(monthlyRetention); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withYearlyRetention(String yearlyRetention) { + this.innerModel().withYearlyRetention(yearlyRetention); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withWeekOfYear(Integer weekOfYear) { + this.innerModel().withWeekOfYear(weekOfYear); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationImpl.java new file mode 100644 index 0000000000000..5db981b72c755 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperation; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationParametersPair; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationSteps; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import java.time.OffsetDateTime; + +public final class ManagedInstanceOperationImpl implements ManagedInstanceOperation { + private ManagedInstanceOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstanceOperationImpl( + ManagedInstanceOperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String managedInstanceName() { + return this.innerModel().managedInstanceName(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public ManagementOperationState state() { + return this.innerModel().state(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public OffsetDateTime estimatedCompletionTime() { + return this.innerModel().estimatedCompletionTime(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public ManagedInstanceOperationParametersPair operationParameters() { + return this.innerModel().operationParameters(); + } + + public ManagedInstanceOperationSteps operationSteps() { + return this.innerModel().operationSteps(); + } + + public ManagedInstanceOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java new file mode 100644 index 0000000000000..014a08f6781b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java @@ -0,0 +1,719 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.sql.generated.fluent.ManagedInstanceOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceOperationsClient. */ +public final class ManagedInstanceOperationsClientImpl implements ManagedInstanceOperationsClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/operations/{operationId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/operations/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("operationId") UUID operationId, + @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> listByManagedInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String managedInstanceName, UUID operationId) { + return cancelWithResponseAsync(resourceGroupName, managedInstanceName, operationId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel(String resourceGroupName, String managedInstanceName, UUID operationId) { + cancelAsync(resourceGroupName, managedInstanceName, operationId).block(); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return cancelWithResponseAsync(resourceGroupName, managedInstanceName, operationId, context).block(); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 operations performed on the managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId 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 management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId 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 management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId 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 management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, UUID operationId) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId 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 management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceOperationInner get(String resourceGroupName, String managedInstanceName, UUID operationId) { + return getAsync(resourceGroupName, managedInstanceName, operationId).block(); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId 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 management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, operationId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list managed instance operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + 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.listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list managed instance operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + 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 + .listByManagedInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.java new file mode 100644 index 0000000000000..66879f2a5c4dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperation; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class ManagedInstanceOperationsImpl implements ManagedInstanceOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceOperationsImpl.class); + + private final ManagedInstanceOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceOperationsImpl( + ManagedInstanceOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void cancel(String resourceGroupName, String managedInstanceName, UUID operationId) { + this.serviceClient().cancel(resourceGroupName, managedInstanceName, operationId); + } + + public Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return this.serviceClient().cancelWithResponse(resourceGroupName, managedInstanceName, operationId, context); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceOperationImpl(inner1, this.manager())); + } + + public ManagedInstanceOperation get(String resourceGroupName, String managedInstanceName, UUID operationId) { + ManagedInstanceOperationInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, operationId); + if (inner != null) { + return new ManagedInstanceOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ManagedInstanceOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java new file mode 100644 index 0000000000000..a2724521b24b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceTdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceTdeCertificatesClient. */ +public final class ManagedInstanceTdeCertificatesClientImpl implements ManagedInstanceTdeCertificatesClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceTdeCertificatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceTdeCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceTdeCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceTdeCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceTdeCertificatesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceTdeCertificates to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceTdeCertificatesService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/tdeCertificates") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TdeCertificate parameters, + Context context); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, managedInstanceName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters).getSyncPoller(); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters, context).getSyncPoller(); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + createAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + createAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.java new file mode 100644 index 0000000000000..632af3f8a75ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.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.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceTdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceTdeCertificates; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstanceTdeCertificatesImpl implements ManagedInstanceTdeCertificates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceTdeCertificatesImpl.class); + + private final ManagedInstanceTdeCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceTdeCertificatesImpl( + ManagedInstanceTdeCertificatesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + this.serviceClient().create(resourceGroupName, managedInstanceName, parameters); + } + + public void create( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + this.serviceClient().create(resourceGroupName, managedInstanceName, parameters, context); + } + + private ManagedInstanceTdeCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..0a91f2120ec1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; + +public final class ManagedInstanceVulnerabilityAssessmentImpl + implements ManagedInstanceVulnerabilityAssessment, + ManagedInstanceVulnerabilityAssessment.Definition, + ManagedInstanceVulnerabilityAssessment.Update { + private ManagedInstanceVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public String storageContainerSasKey() { + return this.innerModel().storageContainerSasKey(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerModel().recurringScans(); + } + + public ManagedInstanceVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + public ManagedInstanceVulnerabilityAssessmentImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceVulnerabilityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedInstanceVulnerabilityAssessmentImpl( + VulnerabilityAssessmentName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceVulnerabilityAssessmentInner(); + this.serviceManager = serviceManager; + this.vulnerabilityAssessmentName = name; + } + + public ManagedInstanceVulnerabilityAssessmentImpl update() { + return this; + } + + public ManagedInstanceVulnerabilityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedInstanceVulnerabilityAssessmentImpl( + ManagedInstanceVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + } + + public ManagedInstanceVulnerabilityAssessment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.innerModel().withStorageContainerPath(storageContainerPath); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.innerModel().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.innerModel().withRecurringScans(recurringScans); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..8da15db139182 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,989 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceVulnerabilityAssessmentsClient. + */ +public final class ManagedInstanceVulnerabilityAssessmentsClientImpl + implements ManagedInstanceVulnerabilityAssessmentsClient { + private final ClientLogger logger = new ClientLogger(ManagedInstanceVulnerabilityAssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceVulnerabilityAssessments to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstanceVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceVulnerabilityAssessmentInner get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName).block(); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, parameters) + .block(); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName).block(); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @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 managed instance's vulnerability assessment policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, 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 the ManagedInstance's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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.listByInstanceNext(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 the ManagedInstance's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..1b0900bf30682 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstanceVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstanceVulnerabilityAssessmentsImpl implements ManagedInstanceVulnerabilityAssessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceVulnerabilityAssessmentsImpl.class); + + private final ManagedInstanceVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceVulnerabilityAssessmentsImpl( + ManagedInstanceVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedInstanceVulnerabilityAssessment get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + ManagedInstanceVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName); + if (inner != null) { + return new ManagedInstanceVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public ManagedInstanceVulnerabilityAssessment 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + this + .deleteWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context); + } + + private ManagedInstanceVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceVulnerabilityAssessmentImpl define(VulnerabilityAssessmentName name) { + return new ManagedInstanceVulnerabilityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java new file mode 100644 index 0000000000000..5deb450637cab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java @@ -0,0 +1,2665 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.AggregationFunctionType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceUpdate; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.TopQueriesListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstancesClient. */ +public final class ManagedInstancesClientImpl implements ManagedInstancesClient { + private final ClientLogger logger = new ClientLogger(ManagedInstancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedInstancesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstancesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ManagedInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstances to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstancesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}/managedInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstancePool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @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.Sql" + + "/managedInstances") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/topqueries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("numberOfQueries") Integer numberOfQueries, + @QueryParam("databases") String databases, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("interval") QueryTimeGrainType interval, + @QueryParam("aggregationFunction") AggregationFunctionType aggregationFunction, + @QueryParam("observationMetric") MetricType observationMetric, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("replicaType") ReplicaType replicaType, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") + @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> listByInstancePoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstanceNext( + @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 list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName) { + 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync(String resourceGroupName, String instancePoolName) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, Context context) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, context), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Context context) { + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName, context)); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances 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 a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String managedInstanceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedInstanceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) { + return getByResourceGroupAsync(resourceGroupName, managedInstanceName).block(); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedInstanceName, context).block(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceInner.class, + ManagedInstanceInner.class, + Context.NONE); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedInstanceInner.class, ManagedInstanceInner.class, context); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String managedInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, managedInstanceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String managedInstanceName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName).getSyncPoller(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, context).getSyncPoller(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedInstanceName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedInstanceName) { + deleteAsync(resourceGroupName, managedInstanceName).block(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, context).block(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceInner> beginUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceInner.class, + ManagedInstanceInner.class, + Context.NONE); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedInstanceInner> beginUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedInstanceInner.class, ManagedInstanceInner.class, context); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters).getSyncPoller(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).getSyncPoller(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner update( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return updateAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner update( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + return updateAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + this.client.getSubscriptionId(), + apiVersion, + 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 top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @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 top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric) { + return new PagedFlux<>( + () -> + listByManagedInstanceSinglePageAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + final Integer numberOfQueries = null; + final String databases = null; + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + final AggregationFunctionType aggregationFunction = null; + final MetricType observationMetric = null; + return new PagedFlux<>( + () -> + listByManagedInstanceSinglePageAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @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 top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context) { + return new PagedFlux<>( + () -> + listByManagedInstanceSinglePageAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName) { + final Integer numberOfQueries = null; + final String databases = null; + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + final AggregationFunctionType aggregationFunction = null; + final MetricType observationMetric = null; + return new PagedIterable<>( + listByManagedInstanceAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric)); + } + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @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 top resource consuming queries of a managed instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context) { + return new PagedIterable<>( + listByManagedInstanceAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + context)); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> failoverWithResponseAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @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>> failoverWithResponseAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, managedInstanceName, replicaType); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, managedInstanceName, replicaType, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType).getSyncPoller(); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType, context).getSyncPoller(); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 failoverAsync(String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 failoverAsync(String resourceGroupName, String managedInstanceName) { + final ReplicaType replicaType = null; + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @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 failoverAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + failoverAsync(resourceGroupName, managedInstanceName, replicaType).block(); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 failover(String resourceGroupName, String managedInstanceName) { + final ReplicaType replicaType = null; + failoverAsync(resourceGroupName, managedInstanceName, replicaType).block(); + } + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + failoverAsync(resourceGroupName, managedInstanceName, replicaType, context).block(); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the 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 a list of managed instances. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync(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.listByInstancePoolNext(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 managed instances. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync( + 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 + .listByInstancePoolNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances. + */ + @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 managed instances. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of top resource consuming queries on managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync(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.listByManagedInstanceNext(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 top resource consuming queries on managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + 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 + .listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances. + */ + @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 a list of managed instances. + */ + @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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.java new file mode 100644 index 0000000000000..eaa9e0bbc8211 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedInstancesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.AggregationFunctionType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstances; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.TopQueries; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedInstancesImpl implements ManagedInstances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstancesImpl.class); + + private final ManagedInstancesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstancesImpl( + ManagedInstancesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + PagedIterable inner = + this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public ManagedInstance getByResourceGroup(String resourceGroupName, String managedInstanceName) { + ManagedInstanceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, managedInstanceName); + if (inner != null) { + return new ManagedInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String managedInstanceName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName); + } + + public void delete(String resourceGroupName, String managedInstanceName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, context); + } + + public PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new TopQueriesImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByManagedInstance( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + context); + return Utils.mapPage(inner, inner1 -> new TopQueriesImpl(inner1, this.manager())); + } + + public void failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + this.serviceClient().failover(resourceGroupName, managedInstanceName, replicaType); + } + + public void failover(String resourceGroupName, String managedInstanceName) { + this.serviceClient().failover(resourceGroupName, managedInstanceName); + } + + public void failover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + this.serviceClient().failover(resourceGroupName, managedInstanceName, replicaType, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public ManagedInstance 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, context); + } + + private ManagedInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceImpl define(String name) { + return new ManagedInstanceImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..d29a46d17d33c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient. + */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl + implements ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { + private final ClientLogger logger = + new ClientLogger(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * SqlManagementClientManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByRestorableDroppedDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @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> listByRestorableDroppedDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + return getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName).block(); + } + + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, context) + .block(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .getSyncPoller(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .block(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .block(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + Context.NONE); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .getSyncPoller(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return updateAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .block(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return updateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .block(); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByRestorableDroppedDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRestorableDroppedDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRestorableDroppedDatabaseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return new PagedFlux<>( + () -> + listByRestorableDroppedDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), + nextLink -> listByRestorableDroppedDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRestorableDroppedDatabaseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + return new PagedFlux<>( + () -> + listByRestorableDroppedDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context), + nextLink -> listByRestorableDroppedDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return new PagedIterable<>( + listByRestorableDroppedDatabaseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId)); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 dropped database's short term retention policy list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + return new PagedIterable<>( + listByRestorableDroppedDatabaseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, 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 short term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseNextSinglePageAsync(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.listByRestorableDroppedDatabaseNext(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 short term retention policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseNextSinglePageAsync(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 + .listByRestorableDroppedDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..a621cfb245f1f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl + implements ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.class); + + private final ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl( + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + ManagedBackupShortTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedBackupShortTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + parameters, + context); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .update(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .update( + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + parameters, + context); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + PagedIterable inner = + this + .serviceClient() + .listByRestorableDroppedDatabase(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByRestorableDroppedDatabase( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..dbd3f2336c42d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,941 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedServerSecurityAlertPoliciesClient. + */ +public final class ManagedServerSecurityAlertPoliciesClientImpl implements ManagedServerSecurityAlertPoliciesClient { + private final ClientLogger logger = new ClientLogger(ManagedServerSecurityAlertPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedServerSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedServerSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedServerSecurityAlertPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedServerSecurityAlertPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedServerSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerSecurityAlertPolicyInner get( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + return getAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName).block(); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, context).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerSecurityAlertPolicyInner.class, + ManagedServerSecurityAlertPolicyInner.class, + Context.NONE); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerSecurityAlertPolicyInner.class, + ManagedServerSecurityAlertPolicyInner.class, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @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 managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context) + .block(); + } + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + 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 managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, 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 the managed Server's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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.listByInstanceNext(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 the managed Server's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..f6b1541c068c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ManagedServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedServerSecurityAlertPoliciesImpl implements ManagedServerSecurityAlertPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedServerSecurityAlertPoliciesImpl.class); + + private final ManagedServerSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedServerSecurityAlertPoliciesImpl( + ManagedServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedServerSecurityAlertPolicy get( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + ManagedServerSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, securityAlertPolicyName); + if (inner != null) { + return new ManagedServerSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedServerSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public ManagedServerSecurityAlertPolicy 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName = + SecurityAlertPolicyNameAutoGenerated.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, 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 managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName = + SecurityAlertPolicyNameAutoGenerated.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, context); + } + + private ManagedServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedServerSecurityAlertPolicyImpl define(SecurityAlertPolicyNameAutoGenerated name) { + return new ManagedServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..24622fcd2c1a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ManagedServerSecurityAlertPolicyImpl + implements ManagedServerSecurityAlertPolicy, + ManagedServerSecurityAlertPolicy.Definition, + ManagedServerSecurityAlertPolicy.Update { + private ManagedServerSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public ManagedServerSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName; + + public ManagedServerSecurityAlertPolicyImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedServerSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedServerSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ManagedServerSecurityAlertPolicyImpl( + SecurityAlertPolicyNameAutoGenerated name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedServerSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ManagedServerSecurityAlertPolicyImpl update() { + return this; + } + + public ManagedServerSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedServerSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ManagedServerSecurityAlertPolicyImpl( + ManagedServerSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.securityAlertPolicyName = + SecurityAlertPolicyNameAutoGenerated + .fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ManagedServerSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedServerSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricDefinitionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricDefinitionImpl.java new file mode 100644 index 0000000000000..3e884accf89d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricDefinitionImpl.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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.models.MetricAvailability; +import com.azure.resourcemanager.sql.generated.models.MetricDefinition; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.sql.generated.models.UnitDefinitionType; +import java.util.Collections; +import java.util.List; + +public final class MetricDefinitionImpl implements MetricDefinition { + private MetricDefinitionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MetricDefinitionImpl( + MetricDefinitionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public MetricName name() { + return this.innerModel().name(); + } + + public PrimaryAggregationType primaryAggregationType() { + return this.innerModel().primaryAggregationType(); + } + + public String resourceUri() { + return this.innerModel().resourceUri(); + } + + public UnitDefinitionType unit() { + return this.innerModel().unit(); + } + + public List metricAvailabilities() { + List inner = this.innerModel().metricAvailabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricImpl.java new file mode 100644 index 0000000000000..d4b96290a9b9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.Metric; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.MetricValue; +import com.azure.resourcemanager.sql.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class MetricImpl implements Metric { + private MetricInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MetricImpl(MetricInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationImpl.java new file mode 100644 index 0000000000000..e06b173a2a7c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.sql.generated.models.Operation; +import com.azure.resourcemanager.sql.generated.models.OperationDisplay; +import com.azure.resourcemanager.sql.generated.models.OperationOrigin; +import java.util.Collections; +import java.util.Map; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager 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.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..bf0c30bfa4435 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.OperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.sql.generated.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 SqlManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientO") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Sql/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 Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..ae22e8df97816 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.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.sql.generated.fluent.OperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.sql.generated.models.Operation; +import com.azure.resourcemanager.sql.generated.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.sql.generated.SqlManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager 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.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..73ebfbd62795c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionImpl.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.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProvisioningState; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..d0de6fc1f2de0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientPrivateEndpointConnections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientP") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @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.Sql/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..3917d33f4cfb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateEndpointConnection get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, serverName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PrivateEndpointConnection 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourceImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..a1ef524652e76 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..e4a1253cb300c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientP") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.Sql/servers" + + "/{serverName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("groupName") String groupName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @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 private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String groupName) { + return getWithResponseAsync(resourceGroupName, serverName, groupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { + return getAsync(resourceGroupName, serverName, groupName).block(); + } + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @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 private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, groupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 private link resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..4116a3f6572e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource get(String resourceGroupName, String serverName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, serverName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolImpl.java new file mode 100644 index 0000000000000..1d2d1168bb4b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolEdition; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPool; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPoolMetric; +import com.azure.resourcemanager.sql.generated.models.TrackedResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class RecommendedElasticPoolImpl implements RecommendedElasticPool { + private RecommendedElasticPoolInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecommendedElasticPoolImpl( + RecommendedElasticPoolInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ElasticPoolEdition databaseEdition() { + return this.innerModel().databaseEdition(); + } + + public Double dtu() { + return this.innerModel().dtu(); + } + + public Double databaseDtuMin() { + return this.innerModel().databaseDtuMin(); + } + + public Double databaseDtuMax() { + return this.innerModel().databaseDtuMax(); + } + + public Double storageMB() { + return this.innerModel().storageMB(); + } + + public OffsetDateTime observationPeriodStart() { + return this.innerModel().observationPeriodStart(); + } + + public OffsetDateTime observationPeriodEnd() { + return this.innerModel().observationPeriodEnd(); + } + + public Double maxObservedDtu() { + return this.innerModel().maxObservedDtu(); + } + + public Double maxObservedStorageMB() { + return this.innerModel().maxObservedStorageMB(); + } + + public List databases() { + List inner = this.innerModel().databases(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List metrics() { + List inner = this.innerModel().metrics(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new RecommendedElasticPoolMetricImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public RecommendedElasticPoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolMetricImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolMetricImpl.java new file mode 100644 index 0000000000000..a86a80f380797 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolMetricImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPoolMetric; +import java.time.OffsetDateTime; + +public final class RecommendedElasticPoolMetricImpl implements RecommendedElasticPoolMetric { + private RecommendedElasticPoolMetricInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecommendedElasticPoolMetricImpl( + RecommendedElasticPoolMetricInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime dateTime() { + return this.innerModel().dateTime(); + } + + public Double dtu() { + return this.innerModel().dtu(); + } + + public Double sizeGB() { + return this.innerModel().sizeGB(); + } + + public RecommendedElasticPoolMetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolsClientImpl.java new file mode 100644 index 0000000000000..969b013236b24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolsClientImpl.java @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RecommendedElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPoolListMetricsResult; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPoolListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecommendedElasticPoolsClient. */ +public final class RecommendedElasticPoolsClientImpl implements RecommendedElasticPoolsClient { + private final ClientLogger logger = new ClientLogger(RecommendedElasticPoolsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecommendedElasticPoolsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedElasticPoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecommendedElasticPoolsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(RecommendedElasticPoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRecommendedElasticPools to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface RecommendedElasticPoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("recommendedElasticPoolName") String recommendedElasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/recommendedElasticPools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("recommendedElasticPoolName") String recommendedElasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recommended elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String recommendedElasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (recommendedElasticPoolName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter recommendedElasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + recommendedElasticPoolName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 recommended elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (recommendedElasticPoolName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter recommendedElasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + recommendedElasticPoolName, + accept, + context); + } + + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recommended elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getWithResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recommended elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendedElasticPoolInner get( + String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getAsync(resourceGroupName, serverName, recommendedElasticPoolName).block(); + } + + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 recommended elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, context).block(); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String recommendedElasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (recommendedElasticPoolName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter recommendedElasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + recommendedElasticPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (recommendedElasticPoolName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter recommendedElasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + recommendedElasticPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, recommendedElasticPoolName)); + } + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, recommendedElasticPoolName, context)); + } + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName)); + } + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 represents the response to a list recommended elastic pool metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolsImpl.java new file mode 100644 index 0000000000000..2f5b7a133af80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedElasticPoolsImpl.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RecommendedElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPool; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPoolMetric; +import com.azure.resourcemanager.sql.generated.models.RecommendedElasticPools; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RecommendedElasticPoolsImpl implements RecommendedElasticPools { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendedElasticPoolsImpl.class); + + private final RecommendedElasticPoolsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RecommendedElasticPoolsImpl( + RecommendedElasticPoolsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RecommendedElasticPool get(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + RecommendedElasticPoolInner inner = + this.serviceClient().get(resourceGroupName, serverName, recommendedElasticPoolName); + if (inner != null) { + return new RecommendedElasticPoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, recommendedElasticPoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendedElasticPoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new RecommendedElasticPoolImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new RecommendedElasticPoolImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, recommendedElasticPoolName); + return Utils.mapPage(inner, inner1 -> new RecommendedElasticPoolMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, recommendedElasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new RecommendedElasticPoolMetricImpl(inner1, this.manager())); + } + + private RecommendedElasticPoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabaseImpl.java new file mode 100644 index 0000000000000..7c4e79f24f588 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabaseImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabase; +import java.time.OffsetDateTime; + +public final class RecoverableDatabaseImpl implements RecoverableDatabase { + private RecoverableDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecoverableDatabaseImpl( + RecoverableDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String edition() { + return this.innerModel().edition(); + } + + public String serviceLevelObjective() { + return this.innerModel().serviceLevelObjective(); + } + + public String elasticPoolName() { + return this.innerModel().elasticPoolName(); + } + + public OffsetDateTime lastAvailableBackupDate() { + return this.innerModel().lastAvailableBackupDate(); + } + + public RecoverableDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java new file mode 100644 index 0000000000000..bbd10b7931cfd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RecoverableDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabaseListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoverableDatabasesClient. */ +public final class RecoverableDatabasesClientImpl implements RecoverableDatabasesClient { + private final ClientLogger logger = new ClientLogger(RecoverableDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecoverableDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(RecoverableDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRecoverableDatabases to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface RecoverableDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/recoverableDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/recoverableDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableDatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of recoverable databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.java new file mode 100644 index 0000000000000..4f08b8f74b327 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RecoverableDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabase; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RecoverableDatabasesImpl implements RecoverableDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableDatabasesImpl.class); + + private final RecoverableDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RecoverableDatabasesImpl( + RecoverableDatabasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RecoverableDatabase get(String resourceGroupName, String serverName, String databaseName) { + RecoverableDatabaseInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new RecoverableDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecoverableDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new RecoverableDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new RecoverableDatabaseImpl(inner1, this.manager())); + } + + private RecoverableDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabaseImpl.java new file mode 100644 index 0000000000000..364d39024cf92 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabaseImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabase; + +public final class RecoverableManagedDatabaseImpl implements RecoverableManagedDatabase { + private RecoverableManagedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecoverableManagedDatabaseImpl( + RecoverableManagedDatabaseInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String lastAvailableBackupDate() { + return this.innerModel().lastAvailableBackupDate(); + } + + public RecoverableManagedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java new file mode 100644 index 0000000000000..7fa09eba53c80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java @@ -0,0 +1,546 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RecoverableManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabaseListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoverableManagedDatabasesClient. */ +public final class RecoverableManagedDatabasesClientImpl implements RecoverableManagedDatabasesClient { + private final ClientLogger logger = new ClientLogger(RecoverableManagedDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecoverableManagedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableManagedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableManagedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RecoverableManagedDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRecoverableManagedDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface RecoverableManagedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/recoverableDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("recoverableDatabaseName") String recoverableDatabaseName, + @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> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName 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 recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (recoverableDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter recoverableDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + recoverableDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName 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 recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (recoverableDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter recoverableDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + recoverableDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName 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 recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName 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 recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + return getAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName).block(); + } + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName 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 recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(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.listByInstanceNext(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 recoverable managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.java new file mode 100644 index 0000000000000..231bda76c77a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RecoverableManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RecoverableManagedDatabasesImpl implements RecoverableManagedDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableManagedDatabasesImpl.class); + + private final RecoverableManagedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RecoverableManagedDatabasesImpl( + RecoverableManagedDatabasesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new RecoverableManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new RecoverableManagedDatabaseImpl(inner1, this.manager())); + } + + public RecoverableManagedDatabase get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + RecoverableManagedDatabaseInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, recoverableDatabaseName); + if (inner != null) { + return new RecoverableManagedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, recoverableDatabaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecoverableManagedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RecoverableManagedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.java new file mode 100644 index 0000000000000..3b15803a063be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ReplicationLink; +import com.azure.resourcemanager.sql.generated.models.ReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ReplicationState; +import java.time.OffsetDateTime; + +public final class ReplicationLinkImpl implements ReplicationLink { + private ReplicationLinkInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ReplicationLinkImpl( + ReplicationLinkInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Boolean isTerminationAllowed() { + return this.innerModel().isTerminationAllowed(); + } + + public String replicationMode() { + return this.innerModel().replicationMode(); + } + + public String partnerServer() { + return this.innerModel().partnerServer(); + } + + public String partnerDatabase() { + return this.innerModel().partnerDatabase(); + } + + public String partnerLocation() { + return this.innerModel().partnerLocation(); + } + + public ReplicationRole role() { + return this.innerModel().role(); + } + + public ReplicationRole partnerRole() { + return this.innerModel().partnerRole(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public ReplicationState replicationState() { + return this.innerModel().replicationState(); + } + + public ReplicationLinkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java new file mode 100644 index 0000000000000..a65b9680c283f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java @@ -0,0 +1,1612 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ReplicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinkListResult; +import com.azure.resourcemanager.sql.generated.models.UnlinkParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReplicationLinksClient. */ +public final class ReplicationLinksClientImpl implements ReplicationLinksClient { + private final ClientLogger logger = new ClientLogger(ReplicationLinksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReplicationLinksService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ReplicationLinksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReplicationLinksClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ReplicationLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientReplicationLinks to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface ReplicationLinksService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failoverAllowDataLoss( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> unlink( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + @BodyParam("application/json") UnlinkParameters parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + context); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String linkId) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, linkId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String databaseName, String linkId) { + deleteAsync(resourceGroupName, serverName, databaseName, linkId).block(); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 serverName, String databaseName, String linkId, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 database replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + accept, + context); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, linkId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getAsync(resourceGroupName, serverName, databaseName, linkId).block(); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 database replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + context); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, linkId); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId).getSyncPoller(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId, context).getSyncPoller(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 failover(String resourceGroupName, String serverName, String databaseName, String linkId) { + failoverAsync(resourceGroupName, serverName, databaseName, linkId).block(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + failoverAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> failoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + return FluxUtil + .withContext( + context -> + service + .failoverAllowDataLoss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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>> failoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + context = this.client.mergeContext(context); + return service + .failoverAllowDataLoss( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + context); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + Mono>> mono = + failoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, databaseName, linkId); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).getSyncPoller(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId, context) + .getSyncPoller(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 failoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + failoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).block(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + failoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> unlinkWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId 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 apiVersion = "2014-04-01"; + return FluxUtil + .withContext( + context -> + service + .unlink( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @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>> unlinkWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId 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 apiVersion = "2014-04-01"; + context = this.client.mergeContext(context); + return service + .unlink( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + linkId, + parameters, + context); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginUnlinkAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters) { + Mono>> mono = + unlinkWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginUnlinkAsync( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + unlinkWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginUnlink( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters) { + return beginUnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).getSyncPoller(); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginUnlink( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context) { + return beginUnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters, context) + .getSyncPoller(); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 unlinkAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters) { + return beginUnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @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 unlinkAsync( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context) { + return beginUnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 unlink( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters) { + unlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).block(); + } + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void unlink( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context) { + unlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters, context).block(); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @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 represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @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 represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @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 represents the response to a List database replication link request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.java new file mode 100644 index 0000000000000..6926b738b52b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ReplicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ReplicationLink; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinks; +import com.azure.resourcemanager.sql.generated.models.UnlinkParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReplicationLinksImpl implements ReplicationLinks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReplicationLinksImpl.class); + + private final ReplicationLinksClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ReplicationLinksImpl( + ReplicationLinksClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String linkId) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, linkId); + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, databaseName, linkId, context); + } + + public ReplicationLink get(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinkInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, linkId); + if (inner != null) { + return new ReplicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, linkId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ReplicationLinkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void failover(String resourceGroupName, String serverName, String databaseName, String linkId) { + this.serviceClient().failover(resourceGroupName, serverName, databaseName, linkId); + } + + public void failover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + this.serviceClient().failover(resourceGroupName, serverName, databaseName, linkId, context); + } + + public void failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + this.serviceClient().failoverAllowDataLoss(resourceGroupName, serverName, databaseName, linkId); + } + + public void failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + this.serviceClient().failoverAllowDataLoss(resourceGroupName, serverName, databaseName, linkId, context); + } + + public void unlink( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters) { + this.serviceClient().unlink(resourceGroupName, serverName, databaseName, linkId, parameters); + } + + public void unlink( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context) { + this.serviceClient().unlink(resourceGroupName, serverName, databaseName, linkId, parameters, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new ReplicationLinkImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ReplicationLinkImpl(inner1, this.manager())); + } + + private ReplicationLinksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.java new file mode 100644 index 0000000000000..8e3f91575e423 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabase; +import java.time.OffsetDateTime; + +public final class RestorableDroppedDatabaseImpl implements RestorableDroppedDatabase { + private RestorableDroppedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RestorableDroppedDatabaseImpl( + RestorableDroppedDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String edition() { + return this.innerModel().edition(); + } + + public String maxSizeBytes() { + return this.innerModel().maxSizeBytes(); + } + + public String serviceLevelObjective() { + return this.innerModel().serviceLevelObjective(); + } + + public String elasticPoolName() { + return this.innerModel().elasticPoolName(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public OffsetDateTime deletionDate() { + return this.innerModel().deletionDate(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public RestorableDroppedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java new file mode 100644 index 0000000000000..76e5af49e6b4e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java @@ -0,0 +1,451 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RestorableDroppedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabaseListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableDroppedDatabasesClient. */ +public final class RestorableDroppedDatabasesClientImpl implements RestorableDroppedDatabasesClient { + private final ClientLogger logger = new ClientLogger(RestorableDroppedDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableDroppedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableDroppedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableDroppedDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRestorableDroppedDatabases to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface RestorableDroppedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("restorableDroppededDatabaseId") String restorableDroppededDatabaseId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/restorableDroppedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deleted database that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (restorableDroppededDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppededDatabaseId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + restorableDroppededDatabaseId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @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 deleted database that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (restorableDroppededDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppededDatabaseId is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + restorableDroppededDatabaseId, + accept, + context); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deleted database that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + return getWithResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deleted database that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorableDroppedDatabaseInner get( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + return getAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).block(); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @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 deleted database that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId, context).block(); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of deleted databases that can be restored. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.java new file mode 100644 index 0000000000000..59722d1aa6421 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RestorableDroppedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabase; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableDroppedDatabasesImpl implements RestorableDroppedDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDroppedDatabasesImpl.class); + + private final RestorableDroppedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RestorableDroppedDatabasesImpl( + RestorableDroppedDatabasesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RestorableDroppedDatabase get( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + RestorableDroppedDatabaseInner inner = + this.serviceClient().get(resourceGroupName, serverName, restorableDroppededDatabaseId); + if (inner != null) { + return new RestorableDroppedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, restorableDroppededDatabaseId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorableDroppedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedDatabaseImpl(inner1, this.manager())); + } + + private RestorableDroppedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabaseImpl.java new file mode 100644 index 0000000000000..ea715a83cfa87 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabaseImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabase; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class RestorableDroppedManagedDatabaseImpl implements RestorableDroppedManagedDatabase { + private RestorableDroppedManagedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RestorableDroppedManagedDatabaseImpl( + RestorableDroppedManagedDatabaseInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public OffsetDateTime deletionDate() { + return this.innerModel().deletionDate(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public RestorableDroppedManagedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java new file mode 100644 index 0000000000000..9fbe5ea8c35e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java @@ -0,0 +1,554 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RestorableDroppedManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabaseListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RestorableDroppedManagedDatabasesClient. + */ +public final class RestorableDroppedManagedDatabasesClientImpl implements RestorableDroppedManagedDatabasesClient { + private final ClientLogger logger = new ClientLogger(RestorableDroppedManagedDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableDroppedManagedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedManagedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableDroppedManagedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableDroppedManagedDatabasesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRestorableDroppedManagedDatabases to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface RestorableDroppedManagedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @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> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorableDroppedManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).block(); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId 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 restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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.listByInstanceNext(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 restorable dropped managed databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.java new file mode 100644 index 0000000000000..eb293b0194647 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RestorableDroppedManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableDroppedManagedDatabasesImpl implements RestorableDroppedManagedDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDroppedManagedDatabasesImpl.class); + + private final RestorableDroppedManagedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RestorableDroppedManagedDatabasesImpl( + RestorableDroppedManagedDatabasesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedManagedDatabaseImpl(inner1, this.manager())); + } + + public RestorableDroppedManagedDatabase get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + RestorableDroppedManagedDatabaseInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId); + if (inner != null) { + return new RestorableDroppedManagedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorableDroppedManagedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RestorableDroppedManagedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointImpl.java new file mode 100644 index 0000000000000..d94e2e1a5d67c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.RestorePoint; +import com.azure.resourcemanager.sql.generated.models.RestorePointType; +import java.time.OffsetDateTime; + +public final class RestorePointImpl implements RestorePoint { + private RestorePointInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RestorePointImpl(RestorePointInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public RestorePointType restorePointType() { + return this.innerModel().restorePointType(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public OffsetDateTime restorePointCreationDate() { + return this.innerModel().restorePointCreationDate(); + } + + public String restorePointLabel() { + return this.innerModel().restorePointLabel(); + } + + public RestorePointInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java new file mode 100644 index 0000000000000..a9f2752c089b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java @@ -0,0 +1,1015 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; +import com.azure.resourcemanager.sql.generated.models.RestorePointListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorePointsClient. */ +public final class RestorePointsClientImpl implements RestorePointsClient { + private final ClientLogger logger = new ClientLogger(RestorePointsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorePointsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorePointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorePointsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(RestorePointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRestorePoints to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface RestorePointsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CreateDatabaseRestorePointDefinition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("restorePointName") String restorePointName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("restorePointName") String restorePointName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database restore points. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database restore points. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, RestorePointInner> beginCreateAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RestorePointInner.class, RestorePointInner.class, Context.NONE); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, RestorePointInner> beginCreateAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RestorePointInner.class, RestorePointInner.class, context); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + return createAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + return createAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner get( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getAsync(resourceGroupName, serverName, databaseName, restorePointName).block(); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName, context).block(); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String restorePointName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 serverName, String databaseName, String restorePointName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String restorePointName) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String databaseName, String restorePointName) { + deleteAsync(resourceGroupName, serverName, databaseName, restorePointName).block(); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 serverName, String databaseName, String restorePointName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.java new file mode 100644 index 0000000000000..8db35e1f6f5f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; +import com.azure.resourcemanager.sql.generated.models.RestorePoint; +import com.azure.resourcemanager.sql.generated.models.RestorePoints; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorePointsImpl implements RestorePoints { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointsImpl.class); + + private final RestorePointsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RestorePointsImpl( + RestorePointsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new RestorePointImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new RestorePointImpl(inner1, this.manager())); + } + + public RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + RestorePointInner inner = this.serviceClient().create(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new RestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + RestorePointInner inner = + this.serviceClient().create(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new RestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public RestorePoint get(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + RestorePointInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, restorePointName); + if (inner != null) { + return new RestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, restorePointName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorePointImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, restorePointName); + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, databaseName, restorePointName, context); + } + + private RestorePointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java new file mode 100644 index 0000000000000..6d20055366aa9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +public final class SensitivityLabelImpl + implements SensitivityLabel, SensitivityLabel.Definition, SensitivityLabel.Update { + private SensitivityLabelInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String labelName() { + return this.innerModel().labelName(); + } + + public String labelId() { + return this.innerModel().labelId(); + } + + public String informationType() { + return this.innerModel().informationType(); + } + + public String informationTypeId() { + return this.innerModel().informationTypeId(); + } + + public Boolean isDisabled() { + return this.innerModel().isDisabled(); + } + + public SensitivityLabelRank rank() { + return this.innerModel().rank(); + } + + public SensitivityLabelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String schemaName; + + private String tableName; + + private String columnName; + + public SensitivityLabelImpl withExistingColumn( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.schemaName = schemaName; + this.tableName = tableName; + this.columnName = columnName; + return this; + } + + public SensitivityLabel create() { + this.innerObject = + serviceManager + .serviceClient() + .getSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SensitivityLabel create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + context) + .getValue(); + return this; + } + + SensitivityLabelImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SensitivityLabelInner(); + this.serviceManager = serviceManager; + } + + public SensitivityLabelImpl update() { + return this; + } + + public SensitivityLabel apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SensitivityLabel apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + context) + .getValue(); + return this; + } + + SensitivityLabelImpl( + SensitivityLabelInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.schemaName = Utils.getValueFromIdByName(innerObject.id(), "schemas"); + this.tableName = Utils.getValueFromIdByName(innerObject.id(), "tables"); + this.columnName = Utils.getValueFromIdByName(innerObject.id(), "columns"); + } + + public SensitivityLabelImpl withLabelName(String labelName) { + this.innerModel().withLabelName(labelName); + return this; + } + + public SensitivityLabelImpl withLabelId(String labelId) { + this.innerModel().withLabelId(labelId); + return this; + } + + public SensitivityLabelImpl withInformationType(String informationType) { + this.innerModel().withInformationType(informationType); + return this; + } + + public SensitivityLabelImpl withInformationTypeId(String informationTypeId) { + this.innerModel().withInformationTypeId(informationTypeId); + return this; + } + + public SensitivityLabelImpl withRank(SensitivityLabelRank rank) { + this.innerModel().withRank(rank); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..4d38739251258 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java @@ -0,0 +1,2143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelListResult; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SensitivityLabelsClient. */ +public final class SensitivityLabelsClientImpl implements SensitivityLabelsClient { + private final ClientLogger logger = new ClientLogger(SensitivityLabelsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SensitivityLabelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSensitivityLabels to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface SensitivityLabelsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/currentSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCurrentByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/recommendedSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRecommendedByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("includeDisabledRecommendations") Boolean includeDisabledRecommendations, + @QueryParam("$skipToken") String skipToken, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}/enable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}/disable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") SensitivityLabelSource sensitivityLabelSource, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SensitivityLabelInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCurrentByDatabaseNext( + @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> listRecommendedByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + return new PagedFlux<>( + () -> listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String filter = null; + return new PagedFlux<>( + () -> listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter, context), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final String filter = null; + return new PagedIterable<>(listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, filter)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, filter, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final Boolean includeDisabledRecommendations = null; + final String skipToken = null; + final String filter = null; + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + context), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final Boolean includeDisabledRecommendations = null; + final String skipToken = null; + final String filter = null; + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context) { + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + serverName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + context)); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> enableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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> enableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 enableRecommendationAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return enableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + enableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .block(); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return enableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> disableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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> disableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 disableRecommendationAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return disableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + disableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .block(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return disableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) + .block(); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + return getWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context) + .block(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters) + .block(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters, context) + .block(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + deleteAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).block(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync(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.listCurrentByDatabaseNext(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 sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync( + 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 + .listCurrentByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync(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.listRecommendedByDatabaseNext(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 sensitivity labels. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync( + 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 + .listRecommendedByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java new file mode 100644 index 0000000000000..2d9ac2257f31d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.SensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabels; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SensitivityLabelsImpl implements SensitivityLabels { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SensitivityLabelsImpl.class); + + private final SensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SensitivityLabelsImpl( + SensitivityLabelsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listCurrentByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listCurrentByDatabase(resourceGroupName, serverName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listRecommendedByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listRecommendedByDatabase( + resourceGroupName, + serverName, + databaseName, + includeDisabledRecommendations, + skipToken, + filter, + context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public void enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .enableRecommendation(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + } + + public Response enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .enableRecommendationWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + } + + public void disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .disableRecommendation(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + } + + public Response disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .disableRecommendationWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + } + + public SensitivityLabel get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + SensitivityLabelInner inner = + this + .serviceClient() + .get( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SensitivityLabelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String schemaName = Utils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + String columnName = Utils.getValueFromIdByName(id, "columns"); + if (columnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'columns'.", id))); + } + this + .deleteWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String schemaName = Utils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + String columnName = Utils.getValueFromIdByName(id, "columns"); + if (columnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'columns'.", id))); + } + return this + .deleteWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + } + + private SensitivityLabelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SensitivityLabelImpl define() { + return new SensitivityLabelImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningImpl.java new file mode 100644 index 0000000000000..083131a4c0f86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTuning; +import java.util.Collections; +import java.util.Map; + +public final class ServerAutomaticTuningImpl implements ServerAutomaticTuning { + private ServerAutomaticTuningInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerAutomaticTuningImpl( + ServerAutomaticTuningInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AutomaticTuningServerMode desiredState() { + return this.innerModel().desiredState(); + } + + public AutomaticTuningServerMode actualState() { + return this.innerModel().actualState(); + } + + public Map options() { + Map inner = this.innerModel().options(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ServerAutomaticTuningInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java new file mode 100644 index 0000000000000..8c89f3be1c918 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerAutomaticTuningsClient. */ +public final class ServerAutomaticTuningsClientImpl implements ServerAutomaticTuningsClient { + private final ClientLogger logger = new ClientLogger(ServerAutomaticTuningsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerAutomaticTuningsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAutomaticTuningsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAutomaticTuningsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerAutomaticTuningsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAutomaticTunings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerAutomaticTuningsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.Sql/servers" + + "/{serverName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerAutomaticTuningInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAutomaticTuningInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).block(); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerAutomaticTuningInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @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-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerAutomaticTuningInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAutomaticTuningInner update( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @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-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..2aff67a5c8bb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTuning; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTunings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerAutomaticTuningsImpl implements ServerAutomaticTunings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAutomaticTuningsImpl.class); + + private final ServerAutomaticTuningsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAutomaticTuningsImpl( + ServerAutomaticTuningsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerAutomaticTuning get(String resourceGroupName, String serverName) { + ServerAutomaticTuningInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ServerAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAutomaticTuning update( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + ServerAutomaticTuningInner inner = this.serviceClient().update(resourceGroupName, serverName, parameters); + if (inner != null) { + return new ServerAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ServerAutomaticTuningsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorImpl.java new file mode 100644 index 0000000000000..c8783e32cfc31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrator; +import java.util.UUID; + +public final class ServerAzureADAdministratorImpl + implements ServerAzureADAdministrator, ServerAzureADAdministrator.Definition, ServerAzureADAdministrator.Update { + private ServerAzureADAdministratorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AdministratorType administratorType() { + return this.innerModel().administratorType(); + } + + public String login() { + return this.innerModel().login(); + } + + public UUID sid() { + return this.innerModel().sid(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public Boolean azureADOnlyAuthentication() { + return this.innerModel().azureADOnlyAuthentication(); + } + + public ServerAzureADAdministratorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private AdministratorName administratorName; + + public ServerAzureADAdministratorImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerAzureADAdministrator create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADAdministrator create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), context); + return this; + } + + ServerAzureADAdministratorImpl( + AdministratorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerAzureADAdministratorInner(); + this.serviceManager = serviceManager; + this.administratorName = name; + } + + public ServerAzureADAdministratorImpl update() { + return this; + } + + public ServerAzureADAdministrator apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADAdministrator apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), context); + return this; + } + + ServerAzureADAdministratorImpl( + ServerAzureADAdministratorInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "administrators")); + } + + public ServerAzureADAdministrator refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .getWithResponse(resourceGroupName, serverName, administratorName, Context.NONE) + .getValue(); + return this; + } + + public ServerAzureADAdministrator refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .getWithResponse(resourceGroupName, serverName, administratorName, context) + .getValue(); + return this; + } + + public ServerAzureADAdministratorImpl withAdministratorType(AdministratorType administratorType) { + this.innerModel().withAdministratorType(administratorType); + return this; + } + + public ServerAzureADAdministratorImpl withLogin(String login) { + this.innerModel().withLogin(login); + return this; + } + + public ServerAzureADAdministratorImpl withSid(UUID sid) { + this.innerModel().withSid(sid); + return this; + } + + public ServerAzureADAdministratorImpl withTenantId(UUID tenantId) { + this.innerModel().withTenantId(tenantId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java new file mode 100644 index 0000000000000..ee8d6a45d59fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java @@ -0,0 +1,1183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorListResult; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerAzureADAdministratorsClient. */ +public final class ServerAzureADAdministratorsClientImpl implements ServerAzureADAdministratorsClient { + private final ClientLogger logger = new ClientLogger(ServerAzureADAdministratorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerAzureADAdministratorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAzureADAdministratorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAzureADAdministratorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerAzureADAdministratorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAzureADAdministrators to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerAzureADAdministratorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators/{administratorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators/{administratorName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + @BodyParam("application/json") ServerAzureADAdministratorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators/{administratorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + administratorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + administratorName, + accept, + context); + } + + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, AdministratorName administratorName) { + return getWithResponseAsync(resourceGroupName, serverName, administratorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADAdministratorInner get( + String resourceGroupName, String serverName, AdministratorName administratorName) { + return getAsync(resourceGroupName, serverName, administratorName).block(); + } + + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, administratorName, context).block(); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + administratorName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + administratorName, + parameters, + accept, + context); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerAzureADAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, administratorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADAdministratorInner.class, + ServerAzureADAdministratorInner.class, + Context.NONE); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerAzureADAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, administratorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADAdministratorInner.class, + ServerAzureADAdministratorInner.class, + context); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters).block(); + } + + /** + * Creates or updates an existing Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @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 azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters, context).block(); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + administratorName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 serverName, AdministratorName administratorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + administratorName, + context); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AdministratorName administratorName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, administratorName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, administratorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName).getSyncPoller(); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName, context).getSyncPoller(); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, AdministratorName administratorName) { + deleteAsync(resourceGroupName, serverName, administratorName).block(); + } + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + deleteAsync(resourceGroupName, serverName, administratorName, context).block(); + } + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of Azure Active Directory administrators in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 active directory administrators. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 active directory administrators. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.java new file mode 100644 index 0000000000000..355545a9e72ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.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.sql.generated.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.sql.generated.fluent.ServerAzureADAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrators; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerAzureADAdministratorsImpl implements ServerAzureADAdministrators { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAzureADAdministratorsImpl.class); + + private final ServerAzureADAdministratorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAzureADAdministratorsImpl( + ServerAzureADAdministratorsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerAzureADAdministrator get( + String resourceGroupName, String serverName, AdministratorName administratorName) { + ServerAzureADAdministratorInner inner = + this.serviceClient().get(resourceGroupName, serverName, administratorName); + if (inner != null) { + return new ServerAzureADAdministratorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, administratorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAzureADAdministratorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, AdministratorName administratorName) { + this.serviceClient().delete(resourceGroupName, serverName, administratorName); + } + + public void delete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, administratorName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerAzureADAdministratorImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerAzureADAdministratorImpl(inner1, this.manager())); + } + + public ServerAzureADAdministrator 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AdministratorName administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(id, "administrators")); + if (administratorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, administratorName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AdministratorName administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(id, "administrators")); + if (administratorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, administratorName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AdministratorName administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(id, "administrators")); + if (administratorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + this.delete(resourceGroupName, serverName, administratorName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AdministratorName administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(id, "administrators")); + if (administratorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + this.delete(resourceGroupName, serverName, administratorName, context); + } + + private ServerAzureADAdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerAzureADAdministratorImpl define(AdministratorName name) { + return new ServerAzureADAdministratorImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationImpl.java new file mode 100644 index 0000000000000..e307d6e309ab0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentication; + +public final class ServerAzureADOnlyAuthenticationImpl + implements ServerAzureADOnlyAuthentication, + ServerAzureADOnlyAuthentication.Definition, + ServerAzureADOnlyAuthentication.Update { + private ServerAzureADOnlyAuthenticationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean azureADOnlyAuthentication() { + return this.innerModel().azureADOnlyAuthentication(); + } + + public ServerAzureADOnlyAuthenticationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private AuthenticationName authenticationName; + + public ServerAzureADOnlyAuthenticationImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerAzureADOnlyAuthentication create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADOnlyAuthentication create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), context); + return this; + } + + ServerAzureADOnlyAuthenticationImpl( + AuthenticationName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerAzureADOnlyAuthenticationInner(); + this.serviceManager = serviceManager; + this.authenticationName = name; + } + + public ServerAzureADOnlyAuthenticationImpl update() { + return this; + } + + public ServerAzureADOnlyAuthentication apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADOnlyAuthentication apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), context); + return this; + } + + ServerAzureADOnlyAuthenticationImpl( + ServerAzureADOnlyAuthenticationInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(innerObject.id(), "azureADOnlyAuthentications")); + } + + public ServerAzureADOnlyAuthentication refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, serverName, authenticationName, Context.NONE) + .getValue(); + return this; + } + + public ServerAzureADOnlyAuthentication refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, serverName, authenticationName, context) + .getValue(); + return this; + } + + public ServerAzureADOnlyAuthenticationImpl withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication) { + this.innerModel().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java new file mode 100644 index 0000000000000..877b0639b7758 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java @@ -0,0 +1,1211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.AzureADOnlyAuthListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ServerAzureADOnlyAuthenticationsClient. + */ +public final class ServerAzureADOnlyAuthenticationsClientImpl implements ServerAzureADOnlyAuthenticationsClient { + private final ClientLogger logger = new ClientLogger(ServerAzureADOnlyAuthenticationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerAzureADOnlyAuthenticationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAzureADOnlyAuthenticationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAzureADOnlyAuthenticationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerAzureADOnlyAuthenticationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAzureADOnlyAuthentications to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerAzureADOnlyAuthenticationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @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.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerAzureADOnlyAuthenticationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + return getWithResponseAsync(resourceGroupName, serverName, authenticationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADOnlyAuthenticationInner get( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + return getAsync(resourceGroupName, serverName, authenticationName).block(); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, authenticationName, context).block(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, authenticationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADOnlyAuthenticationInner.class, + ServerAzureADOnlyAuthenticationInner.class, + Context.NONE); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, authenticationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADOnlyAuthenticationInner.class, + ServerAzureADOnlyAuthenticationInner.class, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters).getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters).block(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @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 azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters, context).block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, AuthenticationName authenticationName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 serverName, AuthenticationName authenticationName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, authenticationName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, authenticationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName, context).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, AuthenticationName authenticationName) { + deleteAsync(resourceGroupName, serverName, authenticationName).block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + deleteAsync(resourceGroupName, serverName, authenticationName, context).block(); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server Azure Active Directory only authentications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 active directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 active directory only authentications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.java new file mode 100644 index 0000000000000..54720a723bc8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentication; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentications; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerAzureADOnlyAuthenticationsImpl implements ServerAzureADOnlyAuthentications { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAzureADOnlyAuthenticationsImpl.class); + + private final ServerAzureADOnlyAuthenticationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAzureADOnlyAuthenticationsImpl( + ServerAzureADOnlyAuthenticationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerAzureADOnlyAuthentication get( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + ServerAzureADOnlyAuthenticationInner inner = + this.serviceClient().get(resourceGroupName, serverName, authenticationName); + if (inner != null) { + return new ServerAzureADOnlyAuthenticationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, authenticationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAzureADOnlyAuthenticationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName) { + this.serviceClient().delete(resourceGroupName, serverName, authenticationName); + } + + public void delete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, authenticationName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public ServerAzureADOnlyAuthentication 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, authenticationName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, authenticationName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + this.delete(resourceGroupName, serverName, authenticationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + AuthenticationName authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(id, "azureADOnlyAuthentications")); + if (authenticationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + this.delete(resourceGroupName, serverName, authenticationName, context); + } + + private ServerAzureADOnlyAuthenticationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerAzureADOnlyAuthenticationImpl define(AuthenticationName name) { + return new ServerAzureADOnlyAuthenticationImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..6ca476008280d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,838 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerBlobAuditingPoliciesClient. */ +public final class ServerBlobAuditingPoliciesClientImpl implements ServerBlobAuditingPoliciesClient { + private final ClientLogger logger = new ClientLogger(ServerBlobAuditingPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerBlobAuditingPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerBlobAuditingPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @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.Sql/servers" + + "/{serverName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/auditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).block(); + } + + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 blobAuditingPolicyName = "default"; + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerBlobAuditingPolicyInner.class, + ServerBlobAuditingPolicyInner.class, + Context.NONE); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerBlobAuditingPolicyInner.class, + ServerBlobAuditingPolicyInner.class, + context); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Creates or updates a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters Properties of blob auditing policy. + * @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 server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server auditing settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 server auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 server auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..9eeb98d1bff0b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerBlobAuditingPoliciesImpl implements ServerBlobAuditingPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerBlobAuditingPoliciesImpl.class); + + private final ServerBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerBlobAuditingPoliciesImpl( + ServerBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerBlobAuditingPolicy get(String resourceGroupName, String serverName) { + ServerBlobAuditingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ServerBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public ServerBlobAuditingPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, context); + } + + private ServerBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerBlobAuditingPolicyImpl define() { + return new ServerBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..c0a0661bb6cfc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ServerBlobAuditingPolicyImpl + implements ServerBlobAuditingPolicy, ServerBlobAuditingPolicy.Definition, ServerBlobAuditingPolicy.Update { + private ServerBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public ServerBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + public ServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ServerBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ServerBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public ServerBlobAuditingPolicyImpl update() { + return this; + } + + public ServerBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ServerBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ServerBlobAuditingPolicyImpl( + ServerBlobAuditingPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + } + + public ServerBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, Context.NONE) + .getValue(); + return this; + } + + public ServerBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, context) + .getValue(); + return this; + } + + public ServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public ServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public ServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + public ServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public ServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ServerBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinkImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinkImpl.java new file mode 100644 index 0000000000000..0273325b03b83 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinkImpl.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.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLink; + +public final class ServerCommunicationLinkImpl + implements ServerCommunicationLink, ServerCommunicationLink.Definition, ServerCommunicationLink.Update { + private ServerCommunicationLinkInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 String kind() { + return this.innerModel().kind(); + } + + public String state() { + return this.innerModel().state(); + } + + public String partnerServer() { + return this.innerModel().partnerServer(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServerCommunicationLinkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String communicationLinkName; + + public ServerCommunicationLinkImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerCommunicationLink create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), Context.NONE); + return this; + } + + public ServerCommunicationLink create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), context); + return this; + } + + ServerCommunicationLinkImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerCommunicationLinkInner(); + this.serviceManager = serviceManager; + this.communicationLinkName = name; + } + + public ServerCommunicationLinkImpl update() { + return this; + } + + public ServerCommunicationLink apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), Context.NONE); + return this; + } + + public ServerCommunicationLink apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), context); + return this; + } + + ServerCommunicationLinkImpl( + ServerCommunicationLinkInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.communicationLinkName = Utils.getValueFromIdByName(innerObject.id(), "communicationLinks"); + } + + public ServerCommunicationLink refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .getWithResponse(resourceGroupName, serverName, communicationLinkName, Context.NONE) + .getValue(); + return this; + } + + public ServerCommunicationLink refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .getWithResponse(resourceGroupName, serverName, communicationLinkName, context) + .getValue(); + return this; + } + + public ServerCommunicationLinkImpl withPartnerServer(String partnerServer) { + this.innerModel().withPartnerServer(partnerServer); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java new file mode 100644 index 0000000000000..9984419f0b0a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java @@ -0,0 +1,979 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerCommunicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLinkListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerCommunicationLinksClient. */ +public final class ServerCommunicationLinksClientImpl implements ServerCommunicationLinksClient { + private final ClientLogger logger = new ClientLogger(ServerCommunicationLinksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerCommunicationLinksService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerCommunicationLinksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerCommunicationLinksClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerCommunicationLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerCommunicationLinks to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerCommunicationLinksService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks/{communicationLinkName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("communicationLinkName") String communicationLinkName, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks/{communicationLinkName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("communicationLinkName") String communicationLinkName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks/{communicationLinkName}") + @ExpectedResponses({201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("communicationLinkName") String communicationLinkName, + @BodyParam("application/json") ServerCommunicationLinkInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String communicationLinkName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 serverName, String communicationLinkName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + context); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String communicationLinkName) { + return deleteWithResponseAsync(resourceGroupName, serverName, communicationLinkName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String communicationLinkName) { + deleteAsync(resourceGroupName, serverName, communicationLinkName).block(); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 serverName, String communicationLinkName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, communicationLinkName, context).block(); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String communicationLinkName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + accept, + context); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String communicationLinkName) { + return getWithResponseAsync(resourceGroupName, serverName, communicationLinkName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerCommunicationLinkInner get(String resourceGroupName, String serverName, String communicationLinkName) { + return getAsync(resourceGroupName, serverName, communicationLinkName).block(); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, communicationLinkName, context).block(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + parameters, + accept, + context); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerCommunicationLinkInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, communicationLinkName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerCommunicationLinkInner.class, + ServerCommunicationLinkInner.class, + Context.NONE); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerCommunicationLinkInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, communicationLinkName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerCommunicationLinkInner.class, + ServerCommunicationLinkInner.class, + context); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters) + .getSyncPoller(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters).block(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @param parameters The required parameters for creating a server communication link. + * @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 communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters, context).block(); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server communication links. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server communication links. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server communication links. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server communication links. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server communication links. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server communication links. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java new file mode 100644 index 0000000000000..f4d21e62c7d2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerCommunicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLink; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLinks; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerCommunicationLinksImpl implements ServerCommunicationLinks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerCommunicationLinksImpl.class); + + private final ServerCommunicationLinksClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerCommunicationLinksImpl( + ServerCommunicationLinksClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String communicationLinkName) { + this.serviceClient().delete(resourceGroupName, serverName, communicationLinkName); + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, communicationLinkName, context); + } + + public ServerCommunicationLink get(String resourceGroupName, String serverName, String communicationLinkName) { + ServerCommunicationLinkInner inner = + this.serviceClient().get(resourceGroupName, serverName, communicationLinkName); + if (inner != null) { + return new ServerCommunicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, communicationLinkName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerCommunicationLinkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerCommunicationLinkImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerCommunicationLinkImpl(inner1, this.manager())); + } + + public ServerCommunicationLink 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, communicationLinkName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, communicationLinkName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, communicationLinkName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, communicationLinkName, context); + } + + private ServerCommunicationLinksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerCommunicationLinkImpl define(String name) { + return new ServerCommunicationLinkImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java new file mode 100644 index 0000000000000..2aa524ad13efa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java @@ -0,0 +1,475 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.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.sql.generated.fluent.ServerConnectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerConnectionPoliciesClient. */ +public final class ServerConnectionPoliciesClientImpl implements ServerConnectionPoliciesClient { + private final ClientLogger logger = new ClientLogger(ServerConnectionPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerConnectionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerConnectionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerConnectionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerConnectionPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerConnectionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerConnectionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/connectionPolicies/{connectionPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("connectionPolicyName") ConnectionPolicyName connectionPolicyName, + @BodyParam("application/json") ServerConnectionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/connectionPolicies/{connectionPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("connectionPolicyName") ConnectionPolicyName connectionPolicyName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates the server's connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a secure connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + connectionPolicyName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the server's connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a secure connection policy. + * @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 server secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + connectionPolicyName, + parameters, + accept, + context); + } + + /** + * Creates or updates the server's connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a secure connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the server's connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a secure connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters).block(); + } + + /** + * Creates or updates the server's connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a secure connection policy. + * @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 server secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context) + .block(); + } + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + connectionPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @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 server's secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + connectionPolicyName, + accept, + context); + } + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, connectionPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + return getAsync(resourceGroupName, serverName, connectionPolicyName).block(); + } + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @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 server's secure connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java new file mode 100644 index 0000000000000..11f020c0d0cbc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerConnectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerConnectionPoliciesImpl implements ServerConnectionPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerConnectionPoliciesImpl.class); + + private final ServerConnectionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerConnectionPoliciesImpl( + ServerConnectionPoliciesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerConnectionPolicy get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + ServerConnectionPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, connectionPolicyName); + if (inner != null) { + return new ServerConnectionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, connectionPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerConnectionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerConnectionPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + ConnectionPolicyName connectionPolicyName = + ConnectionPolicyName.fromString(Utils.getValueFromIdByName(id, "connectionPolicies")); + if (connectionPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'connectionPolicies'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, connectionPolicyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + ConnectionPolicyName connectionPolicyName = + ConnectionPolicyName.fromString(Utils.getValueFromIdByName(id, "connectionPolicies")); + if (connectionPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'connectionPolicies'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, connectionPolicyName, context); + } + + private ServerConnectionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerConnectionPolicyImpl define(ConnectionPolicyName name) { + return new ServerConnectionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.java new file mode 100644 index 0000000000000..09cccbc5ff8c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; + +public final class ServerConnectionPolicyImpl + implements ServerConnectionPolicy, ServerConnectionPolicy.Definition, ServerConnectionPolicy.Update { + private ServerConnectionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public ServerConnectionType connectionType() { + return this.innerModel().connectionType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServerConnectionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private ConnectionPolicyName connectionPolicyName; + + public ServerConnectionPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerConnectionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, connectionPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServerConnectionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, connectionPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + ServerConnectionPolicyImpl( + ConnectionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerConnectionPolicyInner(); + this.serviceManager = serviceManager; + this.connectionPolicyName = name; + } + + public ServerConnectionPolicyImpl update() { + return this; + } + + public ServerConnectionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, connectionPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServerConnectionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, connectionPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + ServerConnectionPolicyImpl( + ServerConnectionPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.connectionPolicyName = + ConnectionPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "connectionPolicies")); + } + + public ServerConnectionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .getWithResponse(resourceGroupName, serverName, connectionPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ServerConnectionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .getWithResponse(resourceGroupName, serverName, connectionPolicyName, context) + .getValue(); + return this; + } + + public ServerConnectionPolicyImpl withConnectionType(ServerConnectionType connectionType) { + this.innerModel().withConnectionType(connectionType); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java new file mode 100644 index 0000000000000..59b36cd5cfed9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java @@ -0,0 +1,917 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerDevOpsAuditSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditSettingsListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerDevOpsAuditSettingsClient. */ +public final class ServerDevOpsAuditSettingsClientImpl implements ServerDevOpsAuditSettingsClient { + private final ClientLogger logger = new ClientLogger(ServerDevOpsAuditSettingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerDevOpsAuditSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerDevOpsAuditSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerDevOpsAuditSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerDevOpsAuditSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerDevOpsAuditSettings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerDevOpsAuditSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("devOpsAuditingSettingsName") String devOpsAuditingSettingsName, + @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.Sql/servers" + + "/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("devOpsAuditingSettingsName") String devOpsAuditingSettingsName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerDevOpsAuditingSettingsInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/devOpsAuditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @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 server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName) { + return getWithResponseAsync(resourceGroupName, serverName, devOpsAuditingSettingsName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDevOpsAuditingSettingsInner get( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName) { + return getAsync(resourceGroupName, serverName, devOpsAuditingSettingsName).block(); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @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 server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, context).block(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName 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 apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName 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 apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDevOpsAuditingSettingsInner.class, + ServerDevOpsAuditingSettingsInner.class, + Context.NONE); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDevOpsAuditingSettingsInner.class, + ServerDevOpsAuditingSettingsInner.class, + context); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters).block(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @param parameters Properties of DevOps audit settings. + * @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 server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + String devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context) + .block(); + } + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 server DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java new file mode 100644 index 0000000000000..86f416bb3c089 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerDevOpsAuditSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditSettings; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerDevOpsAuditSettingsImpl implements ServerDevOpsAuditSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerDevOpsAuditSettingsImpl.class); + + private final ServerDevOpsAuditSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerDevOpsAuditSettingsImpl( + ServerDevOpsAuditSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerDevOpsAuditingSettings get( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName) { + ServerDevOpsAuditingSettingsInner inner = + this.serviceClient().get(resourceGroupName, serverName, devOpsAuditingSettingsName); + if (inner != null) { + return new ServerDevOpsAuditingSettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerDevOpsAuditingSettingsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerDevOpsAuditingSettingsImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerDevOpsAuditingSettingsImpl(inner1, this.manager())); + } + + public ServerDevOpsAuditingSettings 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String devOpsAuditingSettingsName = Utils.getValueFromIdByName(id, "devOpsAuditingSettings"); + if (devOpsAuditingSettingsName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devOpsAuditingSettings'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String devOpsAuditingSettingsName = Utils.getValueFromIdByName(id, "devOpsAuditingSettings"); + if (devOpsAuditingSettingsName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devOpsAuditingSettings'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, context); + } + + private ServerDevOpsAuditSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerDevOpsAuditingSettingsImpl define(String name) { + return new ServerDevOpsAuditingSettingsImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditingSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditingSettingsImpl.java new file mode 100644 index 0000000000000..afdd7ab0065dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditingSettingsImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; +import java.util.UUID; + +public final class ServerDevOpsAuditingSettingsImpl + implements ServerDevOpsAuditingSettings, + ServerDevOpsAuditingSettings.Definition, + ServerDevOpsAuditingSettings.Update { + private ServerDevOpsAuditingSettingsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public ServerDevOpsAuditingSettingsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String devOpsAuditingSettingsName; + + public ServerDevOpsAuditingSettingsImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerDevOpsAuditingSettings create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate( + resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), Context.NONE); + return this; + } + + public ServerDevOpsAuditingSettings create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate(resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), context); + return this; + } + + ServerDevOpsAuditingSettingsImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerDevOpsAuditingSettingsInner(); + this.serviceManager = serviceManager; + this.devOpsAuditingSettingsName = name; + } + + public ServerDevOpsAuditingSettingsImpl update() { + return this; + } + + public ServerDevOpsAuditingSettings apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate( + resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), Context.NONE); + return this; + } + + public ServerDevOpsAuditingSettings apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate(resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), context); + return this; + } + + ServerDevOpsAuditingSettingsImpl( + ServerDevOpsAuditingSettingsInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.devOpsAuditingSettingsName = Utils.getValueFromIdByName(innerObject.id(), "devOpsAuditingSettings"); + } + + public ServerDevOpsAuditingSettings refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, Context.NONE) + .getValue(); + return this; + } + + public ServerDevOpsAuditingSettings refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, context) + .getValue(); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasImpl.java new file mode 100644 index 0000000000000..0b0a405e1da3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasImpl.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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAlias; + +public final class ServerDnsAliasImpl implements ServerDnsAlias { + private ServerDnsAliasInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerDnsAliasImpl( + ServerDnsAliasInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String azureDnsRecord() { + return this.innerModel().azureDnsRecord(); + } + + public ServerDnsAliasInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java new file mode 100644 index 0000000000000..284031e2b3938 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java @@ -0,0 +1,1425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerDnsAliasesClient. */ +public final class ServerDnsAliasesClientImpl implements ServerDnsAliasesClient { + private final ClientLogger logger = new ClientLogger(ServerDnsAliasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerDnsAliasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerDnsAliasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerDnsAliasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerDnsAliasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerDnsAliases to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerDnsAliasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @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.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}/acquire") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> acquire( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerDnsAliasAcquisition parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return getWithResponseAsync(resourceGroupName, serverName, dnsAliasName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner get(String resourceGroupName, String serverName, String dnsAliasName) { + return getAsync(resourceGroupName, serverName, dnsAliasName).block(); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, dnsAliasName, context).block(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerDnsAliasInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, dnsAliasName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDnsAliasInner.class, + ServerDnsAliasInner.class, + Context.NONE); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerDnsAliasInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, dnsAliasName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerDnsAliasInner.class, ServerDnsAliasInner.class, context); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName).getSyncPoller(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName, context).getSyncPoller(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + return createOrUpdateAsync(resourceGroupName, serverName, dnsAliasName).block(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner createOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, dnsAliasName, context).block(); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String dnsAliasName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 serverName, String dnsAliasName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, dnsAliasName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, dnsAliasName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String dnsAliasName) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName).getSyncPoller(); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName, context).getSyncPoller(); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String dnsAliasName) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String dnsAliasName) { + deleteAsync(resourceGroupName, serverName, dnsAliasName).block(); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context) { + deleteAsync(resourceGroupName, serverName, dnsAliasName, context).block(); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @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 server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @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 server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @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 server DNS aliases for a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> acquireWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName 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 apiVersion = "2017-03-01-preview"; + return FluxUtil + .withContext( + context -> + service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> acquireWithResponseAsync( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName 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 apiVersion = "2017-03-01-preview"; + context = this.client.mergeContext(context); + return service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginAcquireAsync( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + Mono>> mono = + acquireWithResponseAsync(resourceGroupName, serverName, dnsAliasName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginAcquireAsync( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + acquireWithResponseAsync(resourceGroupName, serverName, dnsAliasName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginAcquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).getSyncPoller(); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginAcquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters, context).getSyncPoller(); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acquireAsync( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acquireAsync( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + acquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).block(); + } + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + acquireAsync(resourceGroupName, serverName, dnsAliasName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 server DNS aliases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java new file mode 100644 index 0000000000000..31eb446b18cca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAlias; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerDnsAliasesImpl implements ServerDnsAliases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerDnsAliasesImpl.class); + + private final ServerDnsAliasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerDnsAliasesImpl( + ServerDnsAliasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerDnsAlias get(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasInner inner = this.serviceClient().get(resourceGroupName, serverName, dnsAliasName); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, dnsAliasName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerDnsAliasImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerDnsAlias createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasInner inner = this.serviceClient().createOrUpdate(resourceGroupName, serverName, dnsAliasName); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerDnsAlias createOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + ServerDnsAliasInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, dnsAliasName, context); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String dnsAliasName) { + this.serviceClient().delete(resourceGroupName, serverName, dnsAliasName); + } + + public void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, dnsAliasName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerDnsAliasImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerDnsAliasImpl(inner1, this.manager())); + } + + public void acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + this.serviceClient().acquire(resourceGroupName, serverName, dnsAliasName, parameters); + } + + public void acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + this.serviceClient().acquire(resourceGroupName, serverName, dnsAliasName, parameters, context); + } + + private ServerDnsAliasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java new file mode 100644 index 0000000000000..ba7e95fa95e0a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerPublicNetworkAccess; +import com.azure.resourcemanager.sql.generated.models.ServerUpdate; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ServerImpl implements Server, Server.Definition, Server.Update { + private ServerInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 ResourceIdentity identity() { + return this.innerModel().identity(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public String administratorLoginPassword() { + return this.innerModel().administratorLoginPassword(); + } + + public String version() { + return this.innerModel().version(); + } + + public String state() { + return this.innerModel().state(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); + } + + public ServerPublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private ServerUpdate updateParameters; + + public ServerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Server create() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public Server create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ServerImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerInner(); + this.serviceManager = serviceManager; + this.serverName = name; + } + + public ServerImpl update() { + this.updateParameters = new ServerUpdate(); + return this; + } + + public Server apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, Context.NONE); + return this; + } + + public Server apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, context); + return this; + } + + ServerImpl(ServerInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + } + + public Server refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE) + .getValue(); + return this; + } + + public Server refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, context) + .getValue(); + return this; + } + + public ServerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServerImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ServerImpl withIdentity(ResourceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ServerImpl withAdministratorLogin(String administratorLogin) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLogin(administratorLogin); + return this; + } else { + this.updateParameters.withAdministratorLogin(administratorLogin); + return this; + } + } + + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } else { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + } + + public ServerImpl withVersion(String version) { + if (isInCreateMode()) { + this.innerModel().withVersion(version); + return this; + } else { + this.updateParameters.withVersion(version); + return this; + } + } + + public ServerImpl withMinimalTlsVersion(String minimalTlsVersion) { + if (isInCreateMode()) { + this.innerModel().withMinimalTlsVersion(minimalTlsVersion); + return this; + } else { + this.updateParameters.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + } + + public ServerImpl withPublicNetworkAccess(ServerPublicNetworkAccess publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.java new file mode 100644 index 0000000000000..aa087c3a72924 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.sql.generated.models.ServerKey; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import java.time.OffsetDateTime; + +public final class ServerKeyImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { + private ServerKeyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public String subregion() { + return this.innerModel().subregion(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServerKeyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String keyName; + + public ServerKeyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerKey create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), context); + return this; + } + + ServerKeyImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerKeyInner(); + this.serviceManager = serviceManager; + this.keyName = name; + } + + public ServerKeyImpl update() { + return this; + } + + public ServerKey apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), context); + return this; + } + + ServerKeyImpl(ServerKeyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.keyName = Utils.getValueFromIdByName(innerObject.id(), "keys"); + } + + public ServerKey refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, Context.NONE) + .getValue(); + return this; + } + + public ServerKey refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, context) + .getValue(); + return this; + } + + public ServerKeyImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public ServerKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ServerKeyImpl withUri(String uri) { + this.innerModel().withUri(uri); + return this; + } + + public ServerKeyImpl withThumbprint(String thumbprint) { + this.innerModel().withThumbprint(thumbprint); + return this; + } + + public ServerKeyImpl withCreationDate(OffsetDateTime creationDate) { + this.innerModel().withCreationDate(creationDate); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java new file mode 100644 index 0000000000000..00fdc4c3e9c5c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java @@ -0,0 +1,1149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.sql.generated.models.ServerKeyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerKeysClient. */ +public final class ServerKeysClientImpl implements ServerKeysClient { + private final ClientLogger logger = new ClientLogger(ServerKeysClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerKeysService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerKeysClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerKeys to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerKeysService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/keys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.Sql/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @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.Sql/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerKeyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String keyName) { + return getWithResponseAsync(resourceGroupName, serverName, keyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getAsync(resourceGroupName, serverName, keyName).block(); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, keyName, context).block(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, keyName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerKeyInner.class, ServerKeyInner.class, Context.NONE); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, keyName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerKeyInner.class, ServerKeyInner.class, context); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, keyName, parameters).block(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be operated on (updated or created). The key name is required to be + * in the format of 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key + * name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + * @param parameters The requested server key resource state. + * @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 server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, keyName, parameters, context).block(); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String keyName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @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 serverName, String keyName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String keyName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, keyName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String keyName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, keyName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String keyName) { + return beginDeleteAsync(resourceGroupName, serverName, keyName).getSyncPoller(); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, keyName, context).getSyncPoller(); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String keyName) { + return beginDeleteAsync(resourceGroupName, serverName, keyName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, keyName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String keyName) { + deleteAsync(resourceGroupName, serverName, keyName).block(); + } + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String keyName, Context context) { + deleteAsync(resourceGroupName, serverName, keyName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 server keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.java new file mode 100644 index 0000000000000..0d7eba1d1de9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.sql.generated.models.ServerKey; +import com.azure.resourcemanager.sql.generated.models.ServerKeys; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerKeysImpl implements ServerKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerKeysImpl.class); + + private final ServerKeysClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerKeysImpl( + ServerKeysClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); + } + + public ServerKey get(String resourceGroupName, String serverName, String keyName) { + ServerKeyInner inner = this.serviceClient().get(resourceGroupName, serverName, keyName); + if (inner != null) { + return new ServerKeyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, keyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String keyName) { + this.serviceClient().delete(resourceGroupName, serverName, keyName); + } + + public void delete(String resourceGroupName, String serverName, String keyName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, keyName, context); + } + + public ServerKey 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, keyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, keyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, serverName, keyName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, serverName, keyName, context); + } + + private ServerKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerKeyImpl define(String name) { + return new ServerKeyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..968718c06ebf9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,916 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LogicalServerSecurityAlertPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public final class ServerSecurityAlertPoliciesClientImpl implements ServerSecurityAlertPoliciesClient { + private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerSecurityAlertPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerSecurityAlertPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + @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.Sql/servers" + + "/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + return getAsync(resourceGroupName, serverName, securityAlertPolicyName).block(); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, context).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + Context.NONE); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, securityAlertPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context).block(); + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 the server's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 the server's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..c2424c749ff7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.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.sql.generated.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.sql.generated.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAlertPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPoliciesImpl.class); + + private final ServerSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerSecurityAlertPoliciesImpl( + ServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) { + ServerSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, securityAlertPolicyName); + if (inner != null) { + return new ServerSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public ServerSecurityAlertPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName = + SecurityAlertPolicyNameAutoGenerated.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName = + SecurityAlertPolicyNameAutoGenerated.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + } + + private ServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerSecurityAlertPolicyImpl define(SecurityAlertPolicyNameAutoGenerated name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..6c9a73a5b00c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyNameAutoGenerated; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ServerSecurityAlertPolicyImpl + implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { + private ServerSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public ServerSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName; + + public ServerSecurityAlertPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + SecurityAlertPolicyNameAutoGenerated name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ServerSecurityAlertPolicyImpl update() { + return this; + } + + public ServerSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + ServerSecurityAlertPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.securityAlertPolicyName = + SecurityAlertPolicyNameAutoGenerated + .fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ServerSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.java new file mode 100644 index 0000000000000..edd202900db22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.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.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroup; +import java.util.Collections; +import java.util.List; + +public final class ServerTrustGroupImpl + implements ServerTrustGroup, ServerTrustGroup.Definition, ServerTrustGroup.Update { + private ServerTrustGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List groupMembers() { + List inner = this.innerModel().groupMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List trustScopes() { + List inner = this.innerModel().trustScopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ServerTrustGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String locationName; + + private String serverTrustGroupName; + + public ServerTrustGroupImpl withExistingLocation(String resourceGroupName, String locationName) { + this.resourceGroupName = resourceGroupName; + this.locationName = locationName; + return this; + } + + public ServerTrustGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), context); + return this; + } + + ServerTrustGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerTrustGroupInner(); + this.serviceManager = serviceManager; + this.serverTrustGroupName = name; + } + + public ServerTrustGroupImpl update() { + return this; + } + + public ServerTrustGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), context); + return this; + } + + ServerTrustGroupImpl( + ServerTrustGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.locationName = Utils.getValueFromIdByName(innerObject.id(), "locations"); + this.serverTrustGroupName = Utils.getValueFromIdByName(innerObject.id(), "serverTrustGroups"); + } + + public ServerTrustGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .getWithResponse(resourceGroupName, locationName, serverTrustGroupName, Context.NONE) + .getValue(); + return this; + } + + public ServerTrustGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .getWithResponse(resourceGroupName, locationName, serverTrustGroupName, context) + .getValue(); + return this; + } + + public ServerTrustGroupImpl withGroupMembers(List groupMembers) { + this.innerModel().withGroupMembers(groupMembers); + return this; + } + + public ServerTrustGroupImpl withTrustScopes(List trustScopes) { + this.innerModel().withTrustScopes(trustScopes); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsClientImpl.java new file mode 100644 index 0000000000000..ead9fe47920d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsClientImpl.java @@ -0,0 +1,1445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerTrustGroupsClient. */ +public final class ServerTrustGroupsClientImpl implements ServerTrustGroupsClient { + private final ClientLogger logger = new ClientLogger(ServerTrustGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerTrustGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerTrustGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerTrustGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerTrustGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerTrustGroups to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerTrustGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/serverTrustGroups/{serverTrustGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("serverTrustGroupName") String serverTrustGroupName, + @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.Sql/locations" + + "/{locationName}/serverTrustGroups/{serverTrustGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("serverTrustGroupName") String serverTrustGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerTrustGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/serverTrustGroups/{serverTrustGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("serverTrustGroupName") String serverTrustGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/serverTrustGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @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.Sql" + + "/managedInstances/{managedInstanceName}/serverTrustGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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> listByLocationNext( + @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> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + return getWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustGroupInner get(String resourceGroupName, String locationName, String serverTrustGroupName) { + return getAsync(resourceGroupName, locationName, serverTrustGroupName).block(); + } + + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, context).block(); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerTrustGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerTrustGroupInner.class, + ServerTrustGroupInner.class, + Context.NONE); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerTrustGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerTrustGroupInner.class, ServerTrustGroupInner.class, context); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustGroupInner createOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters).block(); + } + + /** + * Creates or updates a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context).block(); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName).getSyncPoller(); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName, context).getSyncPoller(); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String locationName, String serverTrustGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName) { + deleteAsync(resourceGroupName, locationName, serverTrustGroupName).block(); + } + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + deleteAsync(resourceGroupName, locationName, serverTrustGroupName, context).block(); + } + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + 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 a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String resourceGroupName, String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String resourceGroupName, String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName)); + } + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName, context)); + } + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync(String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server trust groups by instance name. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, 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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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.listByLocationNext(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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + 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 + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(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.listByInstanceNext(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 server trust groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + 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 + .listByInstanceNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.java new file mode 100644 index 0000000000000..f5159aa4d7ef3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerTrustGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroup; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerTrustGroupsImpl implements ServerTrustGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerTrustGroupsImpl.class); + + private final ServerTrustGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerTrustGroupsImpl( + ServerTrustGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerTrustGroup get(String resourceGroupName, String locationName, String serverTrustGroupName) { + ServerTrustGroupInner inner = this.serviceClient().get(resourceGroupName, locationName, serverTrustGroupName); + if (inner != null) { + return new ServerTrustGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, locationName, serverTrustGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerTrustGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName) { + this.serviceClient().delete(resourceGroupName, locationName, serverTrustGroupName); + } + + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, locationName, serverTrustGroupName, context); + } + + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName, context); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public ServerTrustGroup 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 locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, locationName, serverTrustGroupName, 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 locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, locationName, serverTrustGroupName, 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 locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + this.delete(resourceGroupName, locationName, serverTrustGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + this.delete(resourceGroupName, locationName, serverTrustGroupName, context); + } + + private ServerTrustGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerTrustGroupImpl define(String name) { + return new ServerTrustGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsageImpl.java new file mode 100644 index 0000000000000..7f3b07096d836 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsageImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.azure.resourcemanager.sql.generated.models.ServerUsage; +import java.time.OffsetDateTime; + +public final class ServerUsageImpl implements ServerUsage { + private ServerUsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerUsageImpl(ServerUsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String resourceName() { + return this.innerModel().resourceName(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Double currentValue() { + return this.innerModel().currentValue(); + } + + public Double limit() { + return this.innerModel().limit(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public OffsetDateTime nextResetTime() { + return this.innerModel().nextResetTime(); + } + + public ServerUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java new file mode 100644 index 0000000000000..e6205d1c7c036 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.azure.resourcemanager.sql.generated.models.ServerUsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerUsagesClient. */ +public final class ServerUsagesClientImpl implements ServerUsagesClient { + private final ClientLogger logger = new ClientLogger(ServerUsagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerUsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerUsagesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerUsages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerUsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.java new file mode 100644 index 0000000000000..495a29f187c30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.azure.resourcemanager.sql.generated.models.ServerUsage; +import com.azure.resourcemanager.sql.generated.models.ServerUsages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerUsagesImpl implements ServerUsages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerUsagesImpl.class); + + private final ServerUsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerUsagesImpl( + ServerUsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerUsageImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerUsageImpl(inner1, this.manager())); + } + + private ServerUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..4bef451913d93 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentImpl.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.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; + +public final class ServerVulnerabilityAssessmentImpl + implements ServerVulnerabilityAssessment, + ServerVulnerabilityAssessment.Definition, + ServerVulnerabilityAssessment.Update { + private ServerVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public String storageContainerSasKey() { + return this.innerModel().storageContainerSasKey(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerModel().recurringScans(); + } + + public ServerVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + public ServerVulnerabilityAssessmentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerVulnerabilityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ServerVulnerabilityAssessmentImpl( + VulnerabilityAssessmentName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerVulnerabilityAssessmentInner(); + this.serviceManager = serviceManager; + this.vulnerabilityAssessmentName = name; + } + + public ServerVulnerabilityAssessmentImpl update() { + return this; + } + + public ServerVulnerabilityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ServerVulnerabilityAssessmentImpl( + ServerVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + } + + public ServerVulnerabilityAssessment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.innerModel().withStorageContainerPath(storageContainerPath); + return this; + } + + public ServerVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.innerModel().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + public ServerVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerVulnerabilityAssessmentImpl withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.innerModel().withRecurringScans(recurringScans); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..a4a096eea837c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,971 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerVulnerabilityAssessmentsClient. */ +public final class ServerVulnerabilityAssessmentsClientImpl implements ServerVulnerabilityAssessmentsClient { + private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerVulnerabilityAssessments to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @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.Sql/servers" + + "/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentInner get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getAsync(resourceGroupName, serverName, vulnerabilityAssessmentName).block(); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).block(); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName 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 apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, parameters).block(); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteAsync(resourceGroupName, serverName, vulnerabilityAssessmentName).block(); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).block(); + } + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 the server's vulnerability assessments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..307dcd571d4fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerVulnerabilityAssessmentsImpl implements ServerVulnerabilityAssessments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentsImpl.class); + + private final ServerVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerVulnerabilityAssessmentsImpl( + ServerVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerVulnerabilityAssessment get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + ServerVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, serverName, vulnerabilityAssessmentName); + if (inner != null) { + return new ServerVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, serverName, vulnerabilityAssessmentName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public ServerVulnerabilityAssessment 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + this.deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); + if (vulnerabilityAssessmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + private ServerVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerVulnerabilityAssessmentImpl define(VulnerabilityAssessmentName name) { + return new ServerVulnerabilityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java new file mode 100644 index 0000000000000..61bd5e95aedfd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java @@ -0,0 +1,2009 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ServerListResult; +import com.azure.resourcemanager.sql.generated.models.ServerUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public final class ServersClientImpl implements ServersClient { + private final ClientLogger logger = new ClientLogger(ServersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServersClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(ServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServers to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers") + @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"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameAvailabilityRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/import") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> importDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ImportNewDatabaseDefinition parameters, + @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 list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String serverName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupAsync(resourceGroupName, serverName).block(); + } + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, Context.NONE); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Creates or updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner createOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { + return beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 serverName) { + return beginDeleteAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 deleteAsync(String resourceGroupName, String serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 serverName) { + deleteAsync(resourceGroupName, serverName).block(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, Context context) { + deleteAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerUpdate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, Context.NONE); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Updates a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested server resource state. + * @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 an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Gets a list of all servers in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, parameters, accept, context); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + CheckNameAvailabilityRequest parameters) { + return checkNameAvailabilityWithResponseAsync(parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest parameters) { + return checkNameAvailabilityAsync(parameters).block(); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context) { + return checkNameAvailabilityWithResponseAsync(parameters, context).block(); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importDatabaseWithResponseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .importDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importDatabaseWithResponseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2020-02-02-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .importDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImportExportOperationResultInner> + beginImportDatabaseAsync(String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + Mono>> mono = + importDatabaseWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + Context.NONE); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImportExportOperationResultInner> + beginImportDatabaseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + importDatabaseWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + context); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImportExportOperationResultInner> + beginImportDatabase(String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImportExportOperationResultInner> + beginImportDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importDatabaseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importDatabaseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + return importDatabaseAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + return importDatabaseAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 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)); + } + + /** + * 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 servers. + */ + @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 a list of servers. + */ + @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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersImpl.java new file mode 100644 index 0000000000000..8118cf417bf0f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.Servers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServersImpl implements Servers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServersImpl.class); + + private final ServersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServersImpl(ServersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public Server getByResourceGroup(String resourceGroupName, String serverName) { + ServerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, serverName); + if (inner != null) { + return new ServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String serverName) { + this.serviceClient().delete(resourceGroupName, serverName); + } + + public void delete(String resourceGroupName, String serverName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest parameters) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(parameters); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + ImportExportOperationResultInner inner = + this.serviceClient().importDatabase(resourceGroupName, serverName, parameters); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + ImportExportOperationResultInner inner = + this.serviceClient().importDatabase(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Server 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + this.delete(resourceGroupName, serverName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + this.delete(resourceGroupName, serverName, context); + } + + private ServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerImpl define(String name) { + return new ServerImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectiveImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectiveImpl.java new file mode 100644 index 0000000000000..5ca565d8aff44 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectiveImpl.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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.azure.resourcemanager.sql.generated.models.ServiceObjective; + +public final class ServiceObjectiveImpl implements ServiceObjective { + private ServiceObjectiveInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServiceObjectiveImpl( + ServiceObjectiveInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String serviceObjectiveName() { + return this.innerModel().serviceObjectiveName(); + } + + public Boolean isDefault() { + return this.innerModel().isDefault(); + } + + public Boolean isSystem() { + return this.innerModel().isSystem(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public ServiceObjectiveInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.java new file mode 100644 index 0000000000000..6aacc9f58ffec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.java @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServiceObjectivesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.azure.resourcemanager.sql.generated.models.ServiceObjectiveListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceObjectivesClient. */ +public final class ServiceObjectivesClientImpl implements ServiceObjectivesClient { + private final ClientLogger logger = new ClientLogger(ServiceObjectivesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServiceObjectivesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceObjectivesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceObjectivesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServiceObjectivesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServiceObjectives to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServiceObjectivesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/serviceObjectives/{serviceObjectiveName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("serviceObjectiveName") String serviceObjectiveName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/serviceObjectives") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String serviceObjectiveName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (serviceObjectiveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceObjectiveName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + serviceObjectiveName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @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 database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (serviceObjectiveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceObjectiveName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + serviceObjectiveName, + accept, + context); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String serviceObjectiveName) { + return getWithResponseAsync(resourceGroupName, serverName, serviceObjectiveName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceObjectiveInner get(String resourceGroupName, String serverName, String serviceObjectiveName) { + return getAsync(resourceGroupName, serverName, serviceObjectiveName).block(); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @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 database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, serviceObjectiveName, context).block(); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.java new file mode 100644 index 0000000000000..57d40b2d92da4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServiceObjectivesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.azure.resourcemanager.sql.generated.models.ServiceObjective; +import com.azure.resourcemanager.sql.generated.models.ServiceObjectives; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServiceObjectivesImpl implements ServiceObjectives { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceObjectivesImpl.class); + + private final ServiceObjectivesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServiceObjectivesImpl( + ServiceObjectivesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceObjective get(String resourceGroupName, String serverName, String serviceObjectiveName) { + ServiceObjectiveInner inner = this.serviceClient().get(resourceGroupName, serverName, serviceObjectiveName); + if (inner != null) { + return new ServiceObjectiveImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, serviceObjectiveName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceObjectiveImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServiceObjectiveImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServiceObjectiveImpl(inner1, this.manager())); + } + + private ServiceObjectivesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorImpl.java new file mode 100644 index 0000000000000..8a4f7474738cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceTierAdvisorInner; +import com.azure.resourcemanager.sql.generated.models.ServiceTierAdvisor; +import com.azure.resourcemanager.sql.generated.models.SloUsageMetric; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ServiceTierAdvisorImpl implements ServiceTierAdvisor { + private ServiceTierAdvisorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServiceTierAdvisorImpl( + ServiceTierAdvisorInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public OffsetDateTime observationPeriodStart() { + return this.innerModel().observationPeriodStart(); + } + + public OffsetDateTime observationPeriodEnd() { + return this.innerModel().observationPeriodEnd(); + } + + public Double activeTimeRatio() { + return this.innerModel().activeTimeRatio(); + } + + public Double minDtu() { + return this.innerModel().minDtu(); + } + + public Double avgDtu() { + return this.innerModel().avgDtu(); + } + + public Double maxDtu() { + return this.innerModel().maxDtu(); + } + + public Double maxSizeInGB() { + return this.innerModel().maxSizeInGB(); + } + + public List serviceLevelObjectiveUsageMetrics() { + List inner = this.innerModel().serviceLevelObjectiveUsageMetrics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String currentServiceLevelObjective() { + return this.innerModel().currentServiceLevelObjective(); + } + + public UUID currentServiceLevelObjectiveId() { + return this.innerModel().currentServiceLevelObjectiveId(); + } + + public String usageBasedRecommendationServiceLevelObjective() { + return this.innerModel().usageBasedRecommendationServiceLevelObjective(); + } + + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.innerModel().usageBasedRecommendationServiceLevelObjectiveId(); + } + + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.innerModel().databaseSizeBasedRecommendationServiceLevelObjective(); + } + + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.innerModel().databaseSizeBasedRecommendationServiceLevelObjectiveId(); + } + + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.innerModel().disasterPlanBasedRecommendationServiceLevelObjective(); + } + + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.innerModel().disasterPlanBasedRecommendationServiceLevelObjectiveId(); + } + + public String overallRecommendationServiceLevelObjective() { + return this.innerModel().overallRecommendationServiceLevelObjective(); + } + + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.innerModel().overallRecommendationServiceLevelObjectiveId(); + } + + public Double confidence() { + return this.innerModel().confidence(); + } + + public ServiceTierAdvisorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorsClientImpl.java new file mode 100644 index 0000000000000..fd163a7068c2d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorsClientImpl.java @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServiceTierAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceTierAdvisorInner; +import com.azure.resourcemanager.sql.generated.models.ServiceTierAdvisorListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceTierAdvisorsClient. */ +public final class ServiceTierAdvisorsClientImpl implements ServiceTierAdvisorsClient { + private final ClientLogger logger = new ClientLogger(ServiceTierAdvisorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServiceTierAdvisorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceTierAdvisorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceTierAdvisorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServiceTierAdvisorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServiceTierAdvisors to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServiceTierAdvisorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("serviceTierAdvisorName") String serviceTierAdvisorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/serviceTierAdvisors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 service tier advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (serviceTierAdvisorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter serviceTierAdvisorName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + serviceTierAdvisorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 service tier advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String serviceTierAdvisorName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (serviceTierAdvisorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter serviceTierAdvisorName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + serviceTierAdvisorName, + accept, + context); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 service tier advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 service tier advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceTierAdvisorInner get( + String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).block(); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 service tier advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String serviceTierAdvisorName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, context) + .block(); + } + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @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 represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @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 represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @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 represents the response to a list service tier advisor request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorsImpl.java new file mode 100644 index 0000000000000..7b9ba534c5d80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceTierAdvisorsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.ServiceTierAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceTierAdvisorInner; +import com.azure.resourcemanager.sql.generated.models.ServiceTierAdvisor; +import com.azure.resourcemanager.sql.generated.models.ServiceTierAdvisors; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServiceTierAdvisorsImpl implements ServiceTierAdvisors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceTierAdvisorsImpl.class); + + private final ServiceTierAdvisorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServiceTierAdvisorsImpl( + ServiceTierAdvisorsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceTierAdvisor get( + String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + ServiceTierAdvisorInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, serviceTierAdvisorName); + if (inner != null) { + return new ServiceTierAdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String serviceTierAdvisorName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceTierAdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new ServiceTierAdvisorImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ServiceTierAdvisorImpl(inner1, this.manager())); + } + + private ServiceTierAdvisorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.java new file mode 100644 index 0000000000000..fc2ca2ce33cfa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.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.sql.generated.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 SqlManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {SqlManagementClientImpl.class}) +public final class SqlManagementClientBuilder { + /* + * The subscription ID that identifies an Azure subscription. + */ + private String subscriptionId; + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder 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 SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder 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 SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder 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 SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder 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 SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of SqlManagementClientImpl with the provided parameters. + * + * @return an instance of SqlManagementClientImpl. + */ + public SqlManagementClientImpl 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(); + } + SqlManagementClientImpl client = + new SqlManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..4ad4a17dd6dc2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java @@ -0,0 +1,1618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.BackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.CapabilitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseThreatDetectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolDatabaseActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.EncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedDatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.GeoBackupPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ImportExportsClient; +import com.azure.resourcemanager.sql.generated.fluent.InstanceFailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.InstancePoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobCredentialsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobStepExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobStepsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobVersionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobsClient; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionManagedInstanceBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRestoreDetailsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceEncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceLongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceTdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.OperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.RecommendedElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ReplicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.sql.generated.fluent.SensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerCommunicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerConnectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerDevOpsAuditSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServersClient; +import com.azure.resourcemanager.sql.generated.fluent.ServiceObjectivesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServiceTierAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlManagementClient; +import com.azure.resourcemanager.sql.generated.fluent.SubscriptionUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.SyncAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.SyncGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.SyncMembersClient; +import com.azure.resourcemanager.sql.generated.fluent.TdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.TransparentDataEncryptionActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.UsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.VirtualClustersClient; +import com.azure.resourcemanager.sql.generated.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadClassifiersClient; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadGroupsClient; +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 SqlManagementClientImpl type. */ +@ServiceClient(builder = SqlManagementClientBuilder.class) +public final class SqlManagementClientImpl implements SqlManagementClient { + private final ClientLogger logger = new ClientLogger(SqlManagementClientImpl.class); + + /** The subscription ID that identifies an Azure subscription. */ + private final String subscriptionId; + + /** + * Gets The 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; + } + + /** 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 RecoverableDatabasesClient object to access its operations. */ + private final RecoverableDatabasesClient recoverableDatabases; + + /** + * Gets the RecoverableDatabasesClient object to access its operations. + * + * @return the RecoverableDatabasesClient object. + */ + public RecoverableDatabasesClient getRecoverableDatabases() { + return this.recoverableDatabases; + } + + /** The RestorableDroppedDatabasesClient object to access its operations. */ + private final RestorableDroppedDatabasesClient restorableDroppedDatabases; + + /** + * Gets the RestorableDroppedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedDatabasesClient object. + */ + public RestorableDroppedDatabasesClient getRestorableDroppedDatabases() { + return this.restorableDroppedDatabases; + } + + /** The ServerConnectionPoliciesClient object to access its operations. */ + private final ServerConnectionPoliciesClient serverConnectionPolicies; + + /** + * Gets the ServerConnectionPoliciesClient object to access its operations. + * + * @return the ServerConnectionPoliciesClient object. + */ + public ServerConnectionPoliciesClient getServerConnectionPolicies() { + return this.serverConnectionPolicies; + } + + /** The DatabaseThreatDetectionPoliciesClient object to access its operations. */ + private final DatabaseThreatDetectionPoliciesClient databaseThreatDetectionPolicies; + + /** + * Gets the DatabaseThreatDetectionPoliciesClient object to access its operations. + * + * @return the DatabaseThreatDetectionPoliciesClient object. + */ + public DatabaseThreatDetectionPoliciesClient getDatabaseThreatDetectionPolicies() { + return this.databaseThreatDetectionPolicies; + } + + /** The DataMaskingPoliciesClient object to access its operations. */ + private final DataMaskingPoliciesClient dataMaskingPolicies; + + /** + * Gets the DataMaskingPoliciesClient object to access its operations. + * + * @return the DataMaskingPoliciesClient object. + */ + public DataMaskingPoliciesClient getDataMaskingPolicies() { + return this.dataMaskingPolicies; + } + + /** The DataMaskingRulesClient object to access its operations. */ + private final DataMaskingRulesClient dataMaskingRules; + + /** + * Gets the DataMaskingRulesClient object to access its operations. + * + * @return the DataMaskingRulesClient object. + */ + public DataMaskingRulesClient getDataMaskingRules() { + return this.dataMaskingRules; + } + + /** The FirewallRulesClient object to access its operations. */ + private final FirewallRulesClient firewallRules; + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + public FirewallRulesClient getFirewallRules() { + return this.firewallRules; + } + + /** The GeoBackupPoliciesClient object to access its operations. */ + private final GeoBackupPoliciesClient geoBackupPolicies; + + /** + * Gets the GeoBackupPoliciesClient object to access its operations. + * + * @return the GeoBackupPoliciesClient object. + */ + public GeoBackupPoliciesClient getGeoBackupPolicies() { + return this.geoBackupPolicies; + } + + /** The DatabasesClient object to access its operations. */ + private final DatabasesClient databases; + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + public DatabasesClient getDatabases() { + return this.databases; + } + + /** The ElasticPoolsClient object to access its operations. */ + private final ElasticPoolsClient elasticPools; + + /** + * Gets the ElasticPoolsClient object to access its operations. + * + * @return the ElasticPoolsClient object. + */ + public ElasticPoolsClient getElasticPools() { + return this.elasticPools; + } + + /** The RecommendedElasticPoolsClient object to access its operations. */ + private final RecommendedElasticPoolsClient recommendedElasticPools; + + /** + * Gets the RecommendedElasticPoolsClient object to access its operations. + * + * @return the RecommendedElasticPoolsClient object. + */ + public RecommendedElasticPoolsClient getRecommendedElasticPools() { + return this.recommendedElasticPools; + } + + /** The ReplicationLinksClient object to access its operations. */ + private final ReplicationLinksClient replicationLinks; + + /** + * Gets the ReplicationLinksClient object to access its operations. + * + * @return the ReplicationLinksClient object. + */ + public ReplicationLinksClient getReplicationLinks() { + return this.replicationLinks; + } + + /** The ServerCommunicationLinksClient object to access its operations. */ + private final ServerCommunicationLinksClient serverCommunicationLinks; + + /** + * Gets the ServerCommunicationLinksClient object to access its operations. + * + * @return the ServerCommunicationLinksClient object. + */ + public ServerCommunicationLinksClient getServerCommunicationLinks() { + return this.serverCommunicationLinks; + } + + /** The ServiceObjectivesClient object to access its operations. */ + private final ServiceObjectivesClient serviceObjectives; + + /** + * Gets the ServiceObjectivesClient object to access its operations. + * + * @return the ServiceObjectivesClient object. + */ + public ServiceObjectivesClient getServiceObjectives() { + return this.serviceObjectives; + } + + /** The ElasticPoolActivitiesClient object to access its operations. */ + private final ElasticPoolActivitiesClient elasticPoolActivities; + + /** + * Gets the ElasticPoolActivitiesClient object to access its operations. + * + * @return the ElasticPoolActivitiesClient object. + */ + public ElasticPoolActivitiesClient getElasticPoolActivities() { + return this.elasticPoolActivities; + } + + /** The ElasticPoolDatabaseActivitiesClient object to access its operations. */ + private final ElasticPoolDatabaseActivitiesClient elasticPoolDatabaseActivities; + + /** + * Gets the ElasticPoolDatabaseActivitiesClient object to access its operations. + * + * @return the ElasticPoolDatabaseActivitiesClient object. + */ + public ElasticPoolDatabaseActivitiesClient getElasticPoolDatabaseActivities() { + return this.elasticPoolDatabaseActivities; + } + + /** The ServiceTierAdvisorsClient object to access its operations. */ + private final ServiceTierAdvisorsClient serviceTierAdvisors; + + /** + * Gets the ServiceTierAdvisorsClient object to access its operations. + * + * @return the ServiceTierAdvisorsClient object. + */ + public ServiceTierAdvisorsClient getServiceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** The TransparentDataEncryptionsClient object to access its operations. */ + private final TransparentDataEncryptionsClient transparentDataEncryptions; + + /** + * Gets the TransparentDataEncryptionsClient object to access its operations. + * + * @return the TransparentDataEncryptionsClient object. + */ + public TransparentDataEncryptionsClient getTransparentDataEncryptions() { + return this.transparentDataEncryptions; + } + + /** The TransparentDataEncryptionActivitiesClient object to access its operations. */ + private final TransparentDataEncryptionActivitiesClient transparentDataEncryptionActivities; + + /** + * Gets the TransparentDataEncryptionActivitiesClient object to access its operations. + * + * @return the TransparentDataEncryptionActivitiesClient object. + */ + public TransparentDataEncryptionActivitiesClient getTransparentDataEncryptionActivities() { + return this.transparentDataEncryptionActivities; + } + + /** The ServerUsagesClient object to access its operations. */ + private final ServerUsagesClient serverUsages; + + /** + * Gets the ServerUsagesClient object to access its operations. + * + * @return the ServerUsagesClient object. + */ + public ServerUsagesClient getServerUsages() { + return this.serverUsages; + } + + /** The DatabaseUsagesClient object to access its operations. */ + private final DatabaseUsagesClient databaseUsages; + + /** + * Gets the DatabaseUsagesClient object to access its operations. + * + * @return the DatabaseUsagesClient object. + */ + public DatabaseUsagesClient getDatabaseUsages() { + return this.databaseUsages; + } + + /** The DatabaseAutomaticTuningsClient object to access its operations. */ + private final DatabaseAutomaticTuningsClient databaseAutomaticTunings; + + /** + * Gets the DatabaseAutomaticTuningsClient object to access its operations. + * + * @return the DatabaseAutomaticTuningsClient object. + */ + public DatabaseAutomaticTuningsClient getDatabaseAutomaticTunings() { + return this.databaseAutomaticTunings; + } + + /** The EncryptionProtectorsClient object to access its operations. */ + private final EncryptionProtectorsClient encryptionProtectors; + + /** + * Gets the EncryptionProtectorsClient object to access its operations. + * + * @return the EncryptionProtectorsClient object. + */ + public EncryptionProtectorsClient getEncryptionProtectors() { + return this.encryptionProtectors; + } + + /** The FailoverGroupsClient object to access its operations. */ + private final FailoverGroupsClient failoverGroups; + + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + public FailoverGroupsClient getFailoverGroups() { + return this.failoverGroups; + } + + /** 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 ServerKeysClient object to access its operations. */ + private final ServerKeysClient serverKeys; + + /** + * Gets the ServerKeysClient object to access its operations. + * + * @return the ServerKeysClient object. + */ + public ServerKeysClient getServerKeys() { + return this.serverKeys; + } + + /** The SyncAgentsClient object to access its operations. */ + private final SyncAgentsClient syncAgents; + + /** + * Gets the SyncAgentsClient object to access its operations. + * + * @return the SyncAgentsClient object. + */ + public SyncAgentsClient getSyncAgents() { + return this.syncAgents; + } + + /** The SubscriptionUsagesClient object to access its operations. */ + private final SubscriptionUsagesClient subscriptionUsages; + + /** + * Gets the SubscriptionUsagesClient object to access its operations. + * + * @return the SubscriptionUsagesClient object. + */ + public SubscriptionUsagesClient getSubscriptionUsages() { + return this.subscriptionUsages; + } + + /** The VirtualClustersClient object to access its operations. */ + private final VirtualClustersClient virtualClusters; + + /** + * Gets the VirtualClustersClient object to access its operations. + * + * @return the VirtualClustersClient object. + */ + public VirtualClustersClient getVirtualClusters() { + return this.virtualClusters; + } + + /** The VirtualNetworkRulesClient object to access its operations. */ + private final VirtualNetworkRulesClient virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + public VirtualNetworkRulesClient getVirtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** The ExtendedDatabaseBlobAuditingPoliciesClient object to access its operations. */ + private final ExtendedDatabaseBlobAuditingPoliciesClient extendedDatabaseBlobAuditingPolicies; + + /** + * Gets the ExtendedDatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedDatabaseBlobAuditingPoliciesClient object. + */ + public ExtendedDatabaseBlobAuditingPoliciesClient getExtendedDatabaseBlobAuditingPolicies() { + return this.extendedDatabaseBlobAuditingPolicies; + } + + /** The ExtendedServerBlobAuditingPoliciesClient object to access its operations. */ + private final ExtendedServerBlobAuditingPoliciesClient extendedServerBlobAuditingPolicies; + + /** + * Gets the ExtendedServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedServerBlobAuditingPoliciesClient object. + */ + public ExtendedServerBlobAuditingPoliciesClient getExtendedServerBlobAuditingPolicies() { + return this.extendedServerBlobAuditingPolicies; + } + + /** The ServerBlobAuditingPoliciesClient object to access its operations. */ + private final ServerBlobAuditingPoliciesClient serverBlobAuditingPolicies; + + /** + * Gets the ServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ServerBlobAuditingPoliciesClient object. + */ + public ServerBlobAuditingPoliciesClient getServerBlobAuditingPolicies() { + return this.serverBlobAuditingPolicies; + } + + /** The DatabaseBlobAuditingPoliciesClient object to access its operations. */ + private final DatabaseBlobAuditingPoliciesClient databaseBlobAuditingPolicies; + + /** + * Gets the DatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the DatabaseBlobAuditingPoliciesClient object. + */ + public DatabaseBlobAuditingPoliciesClient getDatabaseBlobAuditingPolicies() { + return this.databaseBlobAuditingPolicies; + } + + /** The DatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. */ + private final DatabaseVulnerabilityAssessmentRuleBaselinesClient databaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the DatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesClient getDatabaseVulnerabilityAssessmentRuleBaselines() { + return this.databaseVulnerabilityAssessmentRuleBaselines; + } + + /** The DatabaseVulnerabilityAssessmentsClient object to access its operations. */ + private final DatabaseVulnerabilityAssessmentsClient databaseVulnerabilityAssessments; + + /** + * Gets the DatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentsClient object. + */ + public DatabaseVulnerabilityAssessmentsClient getDatabaseVulnerabilityAssessments() { + return this.databaseVulnerabilityAssessments; + } + + /** The JobAgentsClient object to access its operations. */ + private final JobAgentsClient jobAgents; + + /** + * Gets the JobAgentsClient object to access its operations. + * + * @return the JobAgentsClient object. + */ + public JobAgentsClient getJobAgents() { + return this.jobAgents; + } + + /** The JobCredentialsClient object to access its operations. */ + private final JobCredentialsClient jobCredentials; + + /** + * Gets the JobCredentialsClient object to access its operations. + * + * @return the JobCredentialsClient object. + */ + public JobCredentialsClient getJobCredentials() { + return this.jobCredentials; + } + + /** The JobExecutionsClient object to access its operations. */ + private final JobExecutionsClient jobExecutions; + + /** + * Gets the JobExecutionsClient object to access its operations. + * + * @return the JobExecutionsClient object. + */ + public JobExecutionsClient getJobExecutions() { + return this.jobExecutions; + } + + /** The JobsClient object to access its operations. */ + private final JobsClient jobs; + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + public JobsClient getJobs() { + return this.jobs; + } + + /** The JobStepExecutionsClient object to access its operations. */ + private final JobStepExecutionsClient jobStepExecutions; + + /** + * Gets the JobStepExecutionsClient object to access its operations. + * + * @return the JobStepExecutionsClient object. + */ + public JobStepExecutionsClient getJobStepExecutions() { + return this.jobStepExecutions; + } + + /** The JobStepsClient object to access its operations. */ + private final JobStepsClient jobSteps; + + /** + * Gets the JobStepsClient object to access its operations. + * + * @return the JobStepsClient object. + */ + public JobStepsClient getJobSteps() { + return this.jobSteps; + } + + /** The JobTargetExecutionsClient object to access its operations. */ + private final JobTargetExecutionsClient jobTargetExecutions; + + /** + * Gets the JobTargetExecutionsClient object to access its operations. + * + * @return the JobTargetExecutionsClient object. + */ + public JobTargetExecutionsClient getJobTargetExecutions() { + return this.jobTargetExecutions; + } + + /** The JobTargetGroupsClient object to access its operations. */ + private final JobTargetGroupsClient jobTargetGroups; + + /** + * Gets the JobTargetGroupsClient object to access its operations. + * + * @return the JobTargetGroupsClient object. + */ + public JobTargetGroupsClient getJobTargetGroups() { + return this.jobTargetGroups; + } + + /** The JobVersionsClient object to access its operations. */ + private final JobVersionsClient jobVersions; + + /** + * Gets the JobVersionsClient object to access its operations. + * + * @return the JobVersionsClient object. + */ + public JobVersionsClient getJobVersions() { + return this.jobVersions; + } + + /** The ManagedBackupShortTermRetentionPoliciesClient object to access its operations. */ + private final ManagedBackupShortTermRetentionPoliciesClient managedBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedBackupShortTermRetentionPoliciesClient object. + */ + public ManagedBackupShortTermRetentionPoliciesClient getManagedBackupShortTermRetentionPolicies() { + return this.managedBackupShortTermRetentionPolicies; + } + + /** The ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object to access its operations. */ + private final ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient + managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object. + */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient + getManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() { + return this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + } + + /** The ServerAutomaticTuningsClient object to access its operations. */ + private final ServerAutomaticTuningsClient serverAutomaticTunings; + + /** + * Gets the ServerAutomaticTuningsClient object to access its operations. + * + * @return the ServerAutomaticTuningsClient object. + */ + public ServerAutomaticTuningsClient getServerAutomaticTunings() { + return this.serverAutomaticTunings; + } + + /** The ServerDnsAliasesClient object to access its operations. */ + private final ServerDnsAliasesClient serverDnsAliases; + + /** + * Gets the ServerDnsAliasesClient object to access its operations. + * + * @return the ServerDnsAliasesClient object. + */ + public ServerDnsAliasesClient getServerDnsAliases() { + return this.serverDnsAliases; + } + + /** The ServerSecurityAlertPoliciesClient object to access its operations. */ + private final ServerSecurityAlertPoliciesClient serverSecurityAlertPolicies; + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + public ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; + } + + /** The RestorableDroppedManagedDatabasesClient object to access its operations. */ + private final RestorableDroppedManagedDatabasesClient restorableDroppedManagedDatabases; + + /** + * Gets the RestorableDroppedManagedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedManagedDatabasesClient object. + */ + public RestorableDroppedManagedDatabasesClient getRestorableDroppedManagedDatabases() { + return this.restorableDroppedManagedDatabases; + } + + /** The RestorePointsClient object to access its operations. */ + private final RestorePointsClient restorePoints; + + /** + * Gets the RestorePointsClient object to access its operations. + * + * @return the RestorePointsClient object. + */ + public RestorePointsClient getRestorePoints() { + return this.restorePoints; + } + + /** The ManagedDatabaseSecurityAlertPoliciesClient object to access its operations. */ + private final ManagedDatabaseSecurityAlertPoliciesClient managedDatabaseSecurityAlertPolicies; + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedDatabaseSecurityAlertPoliciesClient object. + */ + public ManagedDatabaseSecurityAlertPoliciesClient getManagedDatabaseSecurityAlertPolicies() { + return this.managedDatabaseSecurityAlertPolicies; + } + + /** The ManagedServerSecurityAlertPoliciesClient object to access its operations. */ + private final ManagedServerSecurityAlertPoliciesClient managedServerSecurityAlertPolicies; + + /** + * Gets the ManagedServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedServerSecurityAlertPoliciesClient object. + */ + public ManagedServerSecurityAlertPoliciesClient getManagedServerSecurityAlertPolicies() { + return this.managedServerSecurityAlertPolicies; + } + + /** The SensitivityLabelsClient object to access its operations. */ + private final SensitivityLabelsClient sensitivityLabels; + + /** + * Gets the SensitivityLabelsClient object to access its operations. + * + * @return the SensitivityLabelsClient object. + */ + public SensitivityLabelsClient getSensitivityLabels() { + return this.sensitivityLabels; + } + + /** The ManagedInstanceAdministratorsClient object to access its operations. */ + private final ManagedInstanceAdministratorsClient managedInstanceAdministrators; + + /** + * Gets the ManagedInstanceAdministratorsClient object to access its operations. + * + * @return the ManagedInstanceAdministratorsClient object. + */ + public ManagedInstanceAdministratorsClient getManagedInstanceAdministrators() { + return this.managedInstanceAdministrators; + } + + /** The DatabaseOperationsClient object to access its operations. */ + private final DatabaseOperationsClient databaseOperations; + + /** + * Gets the DatabaseOperationsClient object to access its operations. + * + * @return the DatabaseOperationsClient object. + */ + public DatabaseOperationsClient getDatabaseOperations() { + return this.databaseOperations; + } + + /** The ElasticPoolOperationsClient object to access its operations. */ + private final ElasticPoolOperationsClient elasticPoolOperations; + + /** + * Gets the ElasticPoolOperationsClient object to access its operations. + * + * @return the ElasticPoolOperationsClient object. + */ + public ElasticPoolOperationsClient getElasticPoolOperations() { + return this.elasticPoolOperations; + } + + /** The DatabaseVulnerabilityAssessmentScansClient object to access its operations. */ + private final DatabaseVulnerabilityAssessmentScansClient databaseVulnerabilityAssessmentScans; + + /** + * Gets the DatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentScansClient object. + */ + public DatabaseVulnerabilityAssessmentScansClient getDatabaseVulnerabilityAssessmentScans() { + return this.databaseVulnerabilityAssessmentScans; + } + + /** The ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. */ + private final ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient + managedDatabaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient + getManagedDatabaseVulnerabilityAssessmentRuleBaselines() { + return this.managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** The ManagedDatabaseVulnerabilityAssessmentScansClient object to access its operations. */ + private final ManagedDatabaseVulnerabilityAssessmentScansClient managedDatabaseVulnerabilityAssessmentScans; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentScansClient object. + */ + public ManagedDatabaseVulnerabilityAssessmentScansClient getManagedDatabaseVulnerabilityAssessmentScans() { + return this.managedDatabaseVulnerabilityAssessmentScans; + } + + /** The ManagedDatabaseVulnerabilityAssessmentsClient object to access its operations. */ + private final ManagedDatabaseVulnerabilityAssessmentsClient managedDatabaseVulnerabilityAssessments; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentsClient object. + */ + public ManagedDatabaseVulnerabilityAssessmentsClient getManagedDatabaseVulnerabilityAssessments() { + return this.managedDatabaseVulnerabilityAssessments; + } + + /** The InstanceFailoverGroupsClient object to access its operations. */ + private final InstanceFailoverGroupsClient instanceFailoverGroups; + + /** + * Gets the InstanceFailoverGroupsClient object to access its operations. + * + * @return the InstanceFailoverGroupsClient object. + */ + public InstanceFailoverGroupsClient getInstanceFailoverGroups() { + return this.instanceFailoverGroups; + } + + /** The TdeCertificatesClient object to access its operations. */ + private final TdeCertificatesClient tdeCertificates; + + /** + * Gets the TdeCertificatesClient object to access its operations. + * + * @return the TdeCertificatesClient object. + */ + public TdeCertificatesClient getTdeCertificates() { + return this.tdeCertificates; + } + + /** The ManagedInstanceTdeCertificatesClient object to access its operations. */ + private final ManagedInstanceTdeCertificatesClient managedInstanceTdeCertificates; + + /** + * Gets the ManagedInstanceTdeCertificatesClient object to access its operations. + * + * @return the ManagedInstanceTdeCertificatesClient object. + */ + public ManagedInstanceTdeCertificatesClient getManagedInstanceTdeCertificates() { + return this.managedInstanceTdeCertificates; + } + + /** The ManagedInstanceKeysClient object to access its operations. */ + private final ManagedInstanceKeysClient managedInstanceKeys; + + /** + * Gets the ManagedInstanceKeysClient object to access its operations. + * + * @return the ManagedInstanceKeysClient object. + */ + public ManagedInstanceKeysClient getManagedInstanceKeys() { + return this.managedInstanceKeys; + } + + /** The ManagedInstanceEncryptionProtectorsClient object to access its operations. */ + private final ManagedInstanceEncryptionProtectorsClient managedInstanceEncryptionProtectors; + + /** + * Gets the ManagedInstanceEncryptionProtectorsClient object to access its operations. + * + * @return the ManagedInstanceEncryptionProtectorsClient object. + */ + public ManagedInstanceEncryptionProtectorsClient getManagedInstanceEncryptionProtectors() { + return this.managedInstanceEncryptionProtectors; + } + + /** The RecoverableManagedDatabasesClient object to access its operations. */ + private final RecoverableManagedDatabasesClient recoverableManagedDatabases; + + /** + * Gets the RecoverableManagedDatabasesClient object to access its operations. + * + * @return the RecoverableManagedDatabasesClient object. + */ + public RecoverableManagedDatabasesClient getRecoverableManagedDatabases() { + return this.recoverableManagedDatabases; + } + + /** The BackupShortTermRetentionPoliciesClient object to access its operations. */ + private final BackupShortTermRetentionPoliciesClient backupShortTermRetentionPolicies; + + /** + * Gets the BackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the BackupShortTermRetentionPoliciesClient object. + */ + public BackupShortTermRetentionPoliciesClient getBackupShortTermRetentionPolicies() { + return this.backupShortTermRetentionPolicies; + } + + /** The ManagedInstanceVulnerabilityAssessmentsClient object to access its operations. */ + private final ManagedInstanceVulnerabilityAssessmentsClient managedInstanceVulnerabilityAssessments; + + /** + * Gets the ManagedInstanceVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedInstanceVulnerabilityAssessmentsClient object. + */ + public ManagedInstanceVulnerabilityAssessmentsClient getManagedInstanceVulnerabilityAssessments() { + return this.managedInstanceVulnerabilityAssessments; + } + + /** The ServerVulnerabilityAssessmentsClient object to access its operations. */ + private final ServerVulnerabilityAssessmentsClient serverVulnerabilityAssessments; + + /** + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsClient object. + */ + public ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments() { + return this.serverVulnerabilityAssessments; + } + + /** The ManagedDatabaseSensitivityLabelsClient object to access its operations. */ + private final ManagedDatabaseSensitivityLabelsClient managedDatabaseSensitivityLabels; + + /** + * Gets the ManagedDatabaseSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseSensitivityLabelsClient object. + */ + public ManagedDatabaseSensitivityLabelsClient getManagedDatabaseSensitivityLabels() { + return this.managedDatabaseSensitivityLabels; + } + + /** The InstancePoolsClient object to access its operations. */ + private final InstancePoolsClient instancePools; + + /** + * Gets the InstancePoolsClient object to access its operations. + * + * @return the InstancePoolsClient object. + */ + public InstancePoolsClient getInstancePools() { + return this.instancePools; + } + + /** The UsagesClient object to access its operations. */ + private final UsagesClient usages; + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + public UsagesClient getUsages() { + return this.usages; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** The ServersClient object to access its operations. */ + private final ServersClient servers; + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + public ServersClient getServers() { + return this.servers; + } + + /** The CapabilitiesClient object to access its operations. */ + private final CapabilitiesClient capabilities; + + /** + * Gets the CapabilitiesClient object to access its operations. + * + * @return the CapabilitiesClient object. + */ + public CapabilitiesClient getCapabilities() { + return this.capabilities; + } + + /** The LongTermRetentionManagedInstanceBackupsClient object to access its operations. */ + private final LongTermRetentionManagedInstanceBackupsClient longTermRetentionManagedInstanceBackups; + + /** + * Gets the LongTermRetentionManagedInstanceBackupsClient object to access its operations. + * + * @return the LongTermRetentionManagedInstanceBackupsClient object. + */ + public LongTermRetentionManagedInstanceBackupsClient getLongTermRetentionManagedInstanceBackups() { + return this.longTermRetentionManagedInstanceBackups; + } + + /** The ManagedInstanceLongTermRetentionPoliciesClient object to access its operations. */ + private final ManagedInstanceLongTermRetentionPoliciesClient managedInstanceLongTermRetentionPolicies; + + /** + * Gets the ManagedInstanceLongTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedInstanceLongTermRetentionPoliciesClient object. + */ + public ManagedInstanceLongTermRetentionPoliciesClient getManagedInstanceLongTermRetentionPolicies() { + return this.managedInstanceLongTermRetentionPolicies; + } + + /** The WorkloadGroupsClient object to access its operations. */ + private final WorkloadGroupsClient workloadGroups; + + /** + * Gets the WorkloadGroupsClient object to access its operations. + * + * @return the WorkloadGroupsClient object. + */ + public WorkloadGroupsClient getWorkloadGroups() { + return this.workloadGroups; + } + + /** The WorkloadClassifiersClient object to access its operations. */ + private final WorkloadClassifiersClient workloadClassifiers; + + /** + * Gets the WorkloadClassifiersClient object to access its operations. + * + * @return the WorkloadClassifiersClient object. + */ + public WorkloadClassifiersClient getWorkloadClassifiers() { + return this.workloadClassifiers; + } + + /** The ManagedInstanceOperationsClient object to access its operations. */ + private final ManagedInstanceOperationsClient managedInstanceOperations; + + /** + * Gets the ManagedInstanceOperationsClient object to access its operations. + * + * @return the ManagedInstanceOperationsClient object. + */ + public ManagedInstanceOperationsClient getManagedInstanceOperations() { + return this.managedInstanceOperations; + } + + /** The ServerAzureADAdministratorsClient object to access its operations. */ + private final ServerAzureADAdministratorsClient serverAzureADAdministrators; + + /** + * Gets the ServerAzureADAdministratorsClient object to access its operations. + * + * @return the ServerAzureADAdministratorsClient object. + */ + public ServerAzureADAdministratorsClient getServerAzureADAdministrators() { + return this.serverAzureADAdministrators; + } + + /** The SyncGroupsClient object to access its operations. */ + private final SyncGroupsClient syncGroups; + + /** + * Gets the SyncGroupsClient object to access its operations. + * + * @return the SyncGroupsClient object. + */ + public SyncGroupsClient getSyncGroups() { + return this.syncGroups; + } + + /** The SyncMembersClient object to access its operations. */ + private final SyncMembersClient syncMembers; + + /** + * Gets the SyncMembersClient object to access its operations. + * + * @return the SyncMembersClient object. + */ + public SyncMembersClient getSyncMembers() { + return this.syncMembers; + } + + /** The ImportExportsClient object to access its operations. */ + private final ImportExportsClient importExports; + + /** + * Gets the ImportExportsClient object to access its operations. + * + * @return the ImportExportsClient object. + */ + public ImportExportsClient getImportExports() { + return this.importExports; + } + + /** The ManagedDatabasesClient object to access its operations. */ + private final ManagedDatabasesClient managedDatabases; + + /** + * Gets the ManagedDatabasesClient object to access its operations. + * + * @return the ManagedDatabasesClient object. + */ + public ManagedDatabasesClient getManagedDatabases() { + return this.managedDatabases; + } + + /** The ManagedDatabaseRestoreDetailsClient object to access its operations. */ + private final ManagedDatabaseRestoreDetailsClient managedDatabaseRestoreDetails; + + /** + * Gets the ManagedDatabaseRestoreDetailsClient object to access its operations. + * + * @return the ManagedDatabaseRestoreDetailsClient object. + */ + public ManagedDatabaseRestoreDetailsClient getManagedDatabaseRestoreDetails() { + return this.managedDatabaseRestoreDetails; + } + + /** The ServerAzureADOnlyAuthenticationsClient object to access its operations. */ + private final ServerAzureADOnlyAuthenticationsClient serverAzureADOnlyAuthentications; + + /** + * Gets the ServerAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ServerAzureADOnlyAuthenticationsClient object. + */ + public ServerAzureADOnlyAuthenticationsClient getServerAzureADOnlyAuthentications() { + return this.serverAzureADOnlyAuthentications; + } + + /** The ManagedInstancesClient object to access its operations. */ + private final ManagedInstancesClient managedInstances; + + /** + * Gets the ManagedInstancesClient object to access its operations. + * + * @return the ManagedInstancesClient object. + */ + public ManagedInstancesClient getManagedInstances() { + return this.managedInstances; + } + + /** The ManagedInstanceAzureADOnlyAuthenticationsClient object to access its operations. */ + private final ManagedInstanceAzureADOnlyAuthenticationsClient managedInstanceAzureADOnlyAuthentications; + + /** + * Gets the ManagedInstanceAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ManagedInstanceAzureADOnlyAuthenticationsClient object. + */ + public ManagedInstanceAzureADOnlyAuthenticationsClient getManagedInstanceAzureADOnlyAuthentications() { + return this.managedInstanceAzureADOnlyAuthentications; + } + + /** The ServerTrustGroupsClient object to access its operations. */ + private final ServerTrustGroupsClient serverTrustGroups; + + /** + * Gets the ServerTrustGroupsClient object to access its operations. + * + * @return the ServerTrustGroupsClient object. + */ + public ServerTrustGroupsClient getServerTrustGroups() { + return this.serverTrustGroups; + } + + /** The ServerDevOpsAuditSettingsClient object to access its operations. */ + private final ServerDevOpsAuditSettingsClient serverDevOpsAuditSettings; + + /** + * Gets the ServerDevOpsAuditSettingsClient object to access its operations. + * + * @return the ServerDevOpsAuditSettingsClient object. + */ + public ServerDevOpsAuditSettingsClient getServerDevOpsAuditSettings() { + return this.serverDevOpsAuditSettings; + } + + /** The LongTermRetentionBackupsClient object to access its operations. */ + private final LongTermRetentionBackupsClient longTermRetentionBackups; + + /** + * Gets the LongTermRetentionBackupsClient object to access its operations. + * + * @return the LongTermRetentionBackupsClient object. + */ + public LongTermRetentionBackupsClient getLongTermRetentionBackups() { + return this.longTermRetentionBackups; + } + + /** The LongTermRetentionPoliciesClient object to access its operations. */ + private final LongTermRetentionPoliciesClient longTermRetentionPolicies; + + /** + * Gets the LongTermRetentionPoliciesClient object to access its operations. + * + * @return the LongTermRetentionPoliciesClient object. + */ + public LongTermRetentionPoliciesClient getLongTermRetentionPolicies() { + return this.longTermRetentionPolicies; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The subscription ID that identifies an Azure subscription. + * @param endpoint server parameter. + */ + SqlManagementClientImpl( + 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.recoverableDatabases = new RecoverableDatabasesClientImpl(this); + this.restorableDroppedDatabases = new RestorableDroppedDatabasesClientImpl(this); + this.serverConnectionPolicies = new ServerConnectionPoliciesClientImpl(this); + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesClientImpl(this); + this.dataMaskingPolicies = new DataMaskingPoliciesClientImpl(this); + this.dataMaskingRules = new DataMaskingRulesClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.geoBackupPolicies = new GeoBackupPoliciesClientImpl(this); + this.databases = new DatabasesClientImpl(this); + this.elasticPools = new ElasticPoolsClientImpl(this); + this.recommendedElasticPools = new RecommendedElasticPoolsClientImpl(this); + this.replicationLinks = new ReplicationLinksClientImpl(this); + this.serverCommunicationLinks = new ServerCommunicationLinksClientImpl(this); + this.serviceObjectives = new ServiceObjectivesClientImpl(this); + this.elasticPoolActivities = new ElasticPoolActivitiesClientImpl(this); + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesClientImpl(this); + this.serviceTierAdvisors = new ServiceTierAdvisorsClientImpl(this); + this.transparentDataEncryptions = new TransparentDataEncryptionsClientImpl(this); + this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesClientImpl(this); + this.serverUsages = new ServerUsagesClientImpl(this); + this.databaseUsages = new DatabaseUsagesClientImpl(this); + this.databaseAutomaticTunings = new DatabaseAutomaticTuningsClientImpl(this); + this.encryptionProtectors = new EncryptionProtectorsClientImpl(this); + this.failoverGroups = new FailoverGroupsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.serverKeys = new ServerKeysClientImpl(this); + this.syncAgents = new SyncAgentsClientImpl(this); + this.subscriptionUsages = new SubscriptionUsagesClientImpl(this); + this.virtualClusters = new VirtualClustersClientImpl(this); + this.virtualNetworkRules = new VirtualNetworkRulesClientImpl(this); + this.extendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesClientImpl(this); + this.extendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesClientImpl(this); + this.serverBlobAuditingPolicies = new ServerBlobAuditingPoliciesClientImpl(this); + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesClientImpl(this); + this.databaseVulnerabilityAssessmentRuleBaselines = + new DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsClientImpl(this); + this.jobAgents = new JobAgentsClientImpl(this); + this.jobCredentials = new JobCredentialsClientImpl(this); + this.jobExecutions = new JobExecutionsClientImpl(this); + this.jobs = new JobsClientImpl(this); + this.jobStepExecutions = new JobStepExecutionsClientImpl(this); + this.jobSteps = new JobStepsClientImpl(this); + this.jobTargetExecutions = new JobTargetExecutionsClientImpl(this); + this.jobTargetGroups = new JobTargetGroupsClientImpl(this); + this.jobVersions = new JobVersionsClientImpl(this); + this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesClientImpl(this); + this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = + new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl(this); + this.serverAutomaticTunings = new ServerAutomaticTuningsClientImpl(this); + this.serverDnsAliases = new ServerDnsAliasesClientImpl(this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesClientImpl(this); + this.restorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesClientImpl(this); + this.restorePoints = new RestorePointsClientImpl(this); + this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesClientImpl(this); + this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesClientImpl(this); + this.sensitivityLabels = new SensitivityLabelsClientImpl(this); + this.managedInstanceAdministrators = new ManagedInstanceAdministratorsClientImpl(this); + this.databaseOperations = new DatabaseOperationsClientImpl(this); + this.elasticPoolOperations = new ElasticPoolOperationsClientImpl(this); + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansClientImpl(this); + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = + new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.managedDatabaseVulnerabilityAssessmentScans = + new ManagedDatabaseVulnerabilityAssessmentScansClientImpl(this); + this.managedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsClientImpl(this); + this.instanceFailoverGroups = new InstanceFailoverGroupsClientImpl(this); + this.tdeCertificates = new TdeCertificatesClientImpl(this); + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesClientImpl(this); + this.managedInstanceKeys = new ManagedInstanceKeysClientImpl(this); + this.managedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsClientImpl(this); + this.recoverableManagedDatabases = new RecoverableManagedDatabasesClientImpl(this); + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesClientImpl(this); + this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsClientImpl(this); + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsClientImpl(this); + this.managedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsClientImpl(this); + this.instancePools = new InstancePoolsClientImpl(this); + this.usages = new UsagesClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.servers = new ServersClientImpl(this); + this.capabilities = new CapabilitiesClientImpl(this); + this.longTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsClientImpl(this); + this.managedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesClientImpl(this); + this.workloadGroups = new WorkloadGroupsClientImpl(this); + this.workloadClassifiers = new WorkloadClassifiersClientImpl(this); + this.managedInstanceOperations = new ManagedInstanceOperationsClientImpl(this); + this.serverAzureADAdministrators = new ServerAzureADAdministratorsClientImpl(this); + this.syncGroups = new SyncGroupsClientImpl(this); + this.syncMembers = new SyncMembersClientImpl(this); + this.importExports = new ImportExportsClientImpl(this); + this.managedDatabases = new ManagedDatabasesClientImpl(this); + this.managedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsClientImpl(this); + this.serverAzureADOnlyAuthentications = new ServerAzureADOnlyAuthenticationsClientImpl(this); + this.managedInstances = new ManagedInstancesClientImpl(this); + this.managedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsClientImpl(this); + this.serverTrustGroups = new ServerTrustGroupsClientImpl(this); + this.serverDevOpsAuditSettings = new ServerDevOpsAuditSettingsClientImpl(this); + this.longTermRetentionBackups = new LongTermRetentionBackupsClientImpl(this); + this.longTermRetentionPolicies = new LongTermRetentionPoliciesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsageImpl.java new file mode 100644 index 0000000000000..9022849b9150d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsageImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsage; + +public final class SubscriptionUsageImpl implements SubscriptionUsage { + private SubscriptionUsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SubscriptionUsageImpl( + SubscriptionUsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Double currentValue() { + return this.innerModel().currentValue(); + } + + public Double limit() { + return this.innerModel().limit(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public SubscriptionUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.java new file mode 100644 index 0000000000000..f52f408f986cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.java @@ -0,0 +1,473 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.SubscriptionUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SubscriptionUsagesClient. */ +public final class SubscriptionUsagesClientImpl implements SubscriptionUsagesClient { + private final ClientLogger logger = new ClientLogger(SubscriptionUsagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SubscriptionUsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SubscriptionUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubscriptionUsagesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SubscriptionUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSubscriptionUsages to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface SubscriptionUsagesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @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.Sql/locations/{locationName}/usages/{usageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("usageName") String usageName, + @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> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + this.client.getSubscriptionId(), + apiVersion, + 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 subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), locationName, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + return new PagedIterable<>(listByLocationAsync(locationName)); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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 subscription usage metrics in a given location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, context)); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String usageName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (usageName == null) { + return Mono.error(new IllegalArgumentException("Parameter usageName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + usageName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String usageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (usageName == null) { + return Mono.error(new IllegalArgumentException("Parameter usageName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + usageName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String usageName) { + return getWithResponseAsync(locationName, usageName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionUsageInner get(String locationName, String usageName) { + return getAsync(locationName, usageName).block(); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String locationName, String usageName, Context context) { + return getWithResponseAsync(locationName, usageName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of subscription usage metrics in a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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.listByLocationNext(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 subscription usage metrics in a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + 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 + .listByLocationNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.java new file mode 100644 index 0000000000000..50a606638eba8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.SubscriptionUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsage; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SubscriptionUsagesImpl implements SubscriptionUsages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubscriptionUsagesImpl.class); + + private final SubscriptionUsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SubscriptionUsagesImpl( + SubscriptionUsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new SubscriptionUsageImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(locationName, context); + return Utils.mapPage(inner, inner1 -> new SubscriptionUsageImpl(inner1, this.manager())); + } + + public SubscriptionUsage get(String locationName, String usageName) { + SubscriptionUsageInner inner = this.serviceClient().get(locationName, usageName); + if (inner != null) { + return new SubscriptionUsageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String locationName, String usageName, Context context) { + Response inner = this.serviceClient().getWithResponse(locationName, usageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SubscriptionUsageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SubscriptionUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.java new file mode 100644 index 0000000000000..128da990b55b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; +import com.azure.resourcemanager.sql.generated.models.SyncAgentState; +import java.time.OffsetDateTime; + +public final class SyncAgentImpl implements SyncAgent, SyncAgent.Definition, SyncAgent.Update { + private SyncAgentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String namePropertiesName() { + return this.innerModel().namePropertiesName(); + } + + public String syncDatabaseId() { + return this.innerModel().syncDatabaseId(); + } + + public OffsetDateTime lastAliveTime() { + return this.innerModel().lastAliveTime(); + } + + public SyncAgentState state() { + return this.innerModel().state(); + } + + public Boolean isUpToDate() { + return this.innerModel().isUpToDate(); + } + + public OffsetDateTime expiryTime() { + return this.innerModel().expiryTime(); + } + + public String version() { + return this.innerModel().version(); + } + + public SyncAgentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String syncAgentName; + + public SyncAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public SyncAgent create() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), Context.NONE); + return this; + } + + public SyncAgent create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), context); + return this; + } + + SyncAgentImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SyncAgentInner(); + this.serviceManager = serviceManager; + this.syncAgentName = name; + } + + public SyncAgentImpl update() { + return this; + } + + public SyncAgent apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), Context.NONE); + return this; + } + + public SyncAgent apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), context); + return this; + } + + SyncAgentImpl(SyncAgentInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.syncAgentName = Utils.getValueFromIdByName(innerObject.id(), "syncAgents"); + } + + public SyncAgent refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .getWithResponse(resourceGroupName, serverName, syncAgentName, Context.NONE) + .getValue(); + return this; + } + + public SyncAgent refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .getWithResponse(resourceGroupName, serverName, syncAgentName, context) + .getValue(); + return this; + } + + public SyncAgentImpl withSyncDatabaseId(String syncDatabaseId) { + this.innerModel().withSyncDatabaseId(syncDatabaseId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentKeyPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentKeyPropertiesImpl.java new file mode 100644 index 0000000000000..ff12b28701750 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentKeyPropertiesImpl.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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgentKeyProperties; + +public final class SyncAgentKeyPropertiesImpl implements SyncAgentKeyProperties { + private SyncAgentKeyPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncAgentKeyPropertiesImpl( + SyncAgentKeyPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String syncAgentKey() { + return this.innerModel().syncAgentKey(); + } + + public SyncAgentKeyPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentLinkedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentLinkedDatabaseImpl.java new file mode 100644 index 0000000000000..6256d1a98f8b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentLinkedDatabaseImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgentLinkedDatabase; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +public final class SyncAgentLinkedDatabaseImpl implements SyncAgentLinkedDatabase { + private SyncAgentLinkedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncAgentLinkedDatabaseImpl( + SyncAgentLinkedDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SyncMemberDbType databaseType() { + return this.innerModel().databaseType(); + } + + public String databaseId() { + return this.innerModel().databaseId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String username() { + return this.innerModel().username(); + } + + public SyncAgentLinkedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java new file mode 100644 index 0000000000000..cdf4ed1661442 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java @@ -0,0 +1,1614 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.SyncAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgentLinkedDatabaseListResult; +import com.azure.resourcemanager.sql.generated.models.SyncAgentListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SyncAgentsClient. */ +public final class SyncAgentsClientImpl implements SyncAgentsClient { + private final ClientLogger logger = new ClientLogger(SyncAgentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SyncAgentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SyncAgentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SyncAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSyncAgents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface SyncAgentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @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.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncAgentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}/generateKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> generateKey( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @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.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}/linkedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listLinkedDatabases( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @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> listByServerNext( + @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> listLinkedDatabasesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String syncAgentName) { + return getWithResponseAsync(resourceGroupName, serverName, syncAgentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentInner get(String resourceGroupName, String serverName, String syncAgentName) { + return getAsync(resourceGroupName, serverName, syncAgentName).block(); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, syncAgentName, context).block(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, syncAgentName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncAgentInner.class, SyncAgentInner.class, Context.NONE); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, syncAgentName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncAgentInner.class, SyncAgentInner.class, context); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters).block(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param parameters The requested sync agent resource state. + * @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 an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters, context).block(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String syncAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 serverName, String syncAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String syncAgentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, syncAgentName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, syncAgentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String syncAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName).getSyncPoller(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName, context).getSyncPoller(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String syncAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String syncAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String syncAgentName) { + deleteAsync(resourceGroupName, serverName, syncAgentName).block(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String syncAgentName, Context context) { + deleteAsync(resourceGroupName, serverName, syncAgentName, context).block(); + } + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agents. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @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 sync agents. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agents. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @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 sync agents. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agents. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @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 sync agents. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateKeyWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateKey( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateKeyWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateKey( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateKeyAsync( + String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyWithResponseAsync(resourceGroupName, serverName, syncAgentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentKeyPropertiesInner generateKey(String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyAsync(resourceGroupName, serverName, syncAgentName).block(); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return generateKeyWithResponseAsync(resourceGroupName, serverName, syncAgentName, context).block(); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesSinglePageAsync( + String resourceGroupName, String serverName, String syncAgentName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listLinkedDatabases( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + 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 databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesSinglePageAsync( + String resourceGroupName, String serverName, String syncAgentName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listLinkedDatabases( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLinkedDatabasesAsync( + String resourceGroupName, String serverName, String syncAgentName) { + return new PagedFlux<>( + () -> listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName), + nextLink -> listLinkedDatabasesNextSinglePageAsync(nextLink)); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLinkedDatabasesAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return new PagedFlux<>( + () -> listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName, context), + nextLink -> listLinkedDatabasesNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName) { + return new PagedIterable<>(listLinkedDatabasesAsync(resourceGroupName, serverName, syncAgentName)); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return new PagedIterable<>(listLinkedDatabasesAsync(resourceGroupName, serverName, syncAgentName, 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 sync agents. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 sync agents. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesNextSinglePageAsync(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.listLinkedDatabasesNext(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 sync agent linked databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesNextSinglePageAsync( + 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 + .listLinkedDatabasesNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.java new file mode 100644 index 0000000000000..974bdee0ddf8c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.SyncAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; +import com.azure.resourcemanager.sql.generated.models.SyncAgentKeyProperties; +import com.azure.resourcemanager.sql.generated.models.SyncAgentLinkedDatabase; +import com.azure.resourcemanager.sql.generated.models.SyncAgents; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SyncAgentsImpl implements SyncAgents { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncAgentsImpl.class); + + private final SyncAgentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SyncAgentsImpl( + SyncAgentsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SyncAgent get(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentInner inner = this.serviceClient().get(resourceGroupName, serverName, syncAgentName); + if (inner != null) { + return new SyncAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, syncAgentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncAgentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String syncAgentName) { + this.serviceClient().delete(resourceGroupName, serverName, syncAgentName); + } + + public void delete(String resourceGroupName, String serverName, String syncAgentName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, syncAgentName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new SyncAgentImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new SyncAgentImpl(inner1, this.manager())); + } + + public SyncAgentKeyProperties generateKey(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentKeyPropertiesInner inner = + this.serviceClient().generateKey(resourceGroupName, serverName, syncAgentName); + if (inner != null) { + return new SyncAgentKeyPropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + Response inner = + this.serviceClient().generateKeyWithResponse(resourceGroupName, serverName, syncAgentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncAgentKeyPropertiesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName) { + PagedIterable inner = + this.serviceClient().listLinkedDatabases(resourceGroupName, serverName, syncAgentName); + return Utils.mapPage(inner, inner1 -> new SyncAgentLinkedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listLinkedDatabases(resourceGroupName, serverName, syncAgentName, context); + return Utils.mapPage(inner, inner1 -> new SyncAgentLinkedDatabaseImpl(inner1, this.manager())); + } + + public SyncAgent 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, syncAgentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, syncAgentName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + this.delete(resourceGroupName, serverName, syncAgentName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + this.delete(resourceGroupName, serverName, syncAgentName, context); + } + + private SyncAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SyncAgentImpl define(String name) { + return new SyncAgentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncDatabaseIdPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncDatabaseIdPropertiesImpl.java new file mode 100644 index 0000000000000..4718e8f8a2e28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncDatabaseIdPropertiesImpl.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.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncDatabaseIdProperties; + +public final class SyncDatabaseIdPropertiesImpl implements SyncDatabaseIdProperties { + private SyncDatabaseIdPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncDatabaseIdPropertiesImpl( + SyncDatabaseIdPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public SyncDatabaseIdPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncFullSchemaPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncFullSchemaPropertiesImpl.java new file mode 100644 index 0000000000000..2bf2920f621a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncFullSchemaPropertiesImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaProperties; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaTable; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class SyncFullSchemaPropertiesImpl implements SyncFullSchemaProperties { + private SyncFullSchemaPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncFullSchemaPropertiesImpl( + SyncFullSchemaPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List tables() { + List inner = this.innerModel().tables(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime lastUpdateTime() { + return this.innerModel().lastUpdateTime(); + } + + public SyncFullSchemaPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java new file mode 100644 index 0000000000000..05d37dbc772e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; +import com.azure.resourcemanager.sql.generated.models.SyncGroupSchema; +import com.azure.resourcemanager.sql.generated.models.SyncGroupState; +import java.time.OffsetDateTime; + +public final class SyncGroupImpl implements SyncGroup, SyncGroup.Definition, SyncGroup.Update { + private SyncGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer interval() { + return this.innerModel().interval(); + } + + public OffsetDateTime lastSyncTime() { + return this.innerModel().lastSyncTime(); + } + + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.innerModel().conflictResolutionPolicy(); + } + + public String syncDatabaseId() { + return this.innerModel().syncDatabaseId(); + } + + public String hubDatabaseUsername() { + return this.innerModel().hubDatabaseUsername(); + } + + public String hubDatabasePassword() { + return this.innerModel().hubDatabasePassword(); + } + + public SyncGroupState syncState() { + return this.innerModel().syncState(); + } + + public SyncGroupSchema schema() { + return this.innerModel().schema(); + } + + public Boolean usePrivateLinkConnection() { + return this.innerModel().usePrivateLinkConnection(); + } + + public String privateEndpointName() { + return this.innerModel().privateEndpointName(); + } + + public SyncGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String syncGroupName; + + public SyncGroupImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public SyncGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), Context.NONE); + return this; + } + + public SyncGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .createOrUpdate(resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), context); + return this; + } + + SyncGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SyncGroupInner(); + this.serviceManager = serviceManager; + this.syncGroupName = name; + } + + public SyncGroupImpl update() { + return this; + } + + public SyncGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .update(resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), Context.NONE); + return this; + } + + public SyncGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .update(resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), context); + return this; + } + + SyncGroupImpl(SyncGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.syncGroupName = Utils.getValueFromIdByName(innerObject.id(), "syncGroups"); + } + + public SyncGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE) + .getValue(); + return this; + } + + public SyncGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context) + .getValue(); + return this; + } + + public SyncGroupImpl withInterval(Integer interval) { + this.innerModel().withInterval(interval); + return this; + } + + public SyncGroupImpl withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.innerModel().withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + public SyncGroupImpl withSyncDatabaseId(String syncDatabaseId) { + this.innerModel().withSyncDatabaseId(syncDatabaseId); + return this; + } + + public SyncGroupImpl withHubDatabaseUsername(String hubDatabaseUsername) { + this.innerModel().withHubDatabaseUsername(hubDatabaseUsername); + return this; + } + + public SyncGroupImpl withHubDatabasePassword(String hubDatabasePassword) { + this.innerModel().withHubDatabasePassword(hubDatabasePassword); + return this; + } + + public SyncGroupImpl withSchema(SyncGroupSchema schema) { + this.innerModel().withSchema(schema); + return this; + } + + public SyncGroupImpl withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.innerModel().withUsePrivateLinkConnection(usePrivateLinkConnection); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupLogPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupLogPropertiesImpl.java new file mode 100644 index 0000000000000..e7b1eb03741dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupLogPropertiesImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogProperties; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogType; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class SyncGroupLogPropertiesImpl implements SyncGroupLogProperties { + private SyncGroupLogPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncGroupLogPropertiesImpl( + SyncGroupLogPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime timestamp() { + return this.innerModel().timestamp(); + } + + public SyncGroupLogType type() { + return this.innerModel().type(); + } + + public String source() { + return this.innerModel().source(); + } + + public String details() { + return this.innerModel().details(); + } + + public UUID tracingId() { + return this.innerModel().tracingId(); + } + + public String operationStatus() { + return this.innerModel().operationStatus(); + } + + public SyncGroupLogPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java new file mode 100644 index 0000000000000..75c497c903516 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java @@ -0,0 +1,3366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.SyncGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncDatabaseIdListResult; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaPropertiesListResult; +import com.azure.resourcemanager.sql.generated.models.SyncGroupListResult; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogListResult; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SyncGroupsClient. */ +public final class SyncGroupsClientImpl implements SyncGroupsClient { + private final ClientLogger logger = new ClientLogger(SyncGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SyncGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SyncGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SyncGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSyncGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface SyncGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSyncDatabaseIds( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> refreshHubSchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHubSchemas( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listLogs( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("type") SyncGroupsType type, + @QueryParam("continuationToken") String continuationToken, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelSync( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> triggerSync( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listSyncDatabaseIdsNext( + @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> listHubSchemasNext( + @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> listLogsNext( + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsSinglePageAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSyncDatabaseIds( + this.client.getEndpoint(), + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsSinglePageAsync( + String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSyncDatabaseIds( + this.client.getEndpoint(), locationName, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSyncDatabaseIdsAsync(String locationName) { + return new PagedFlux<>( + () -> listSyncDatabaseIdsSinglePageAsync(locationName), + nextLink -> listSyncDatabaseIdsNextSinglePageAsync(nextLink)); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSyncDatabaseIdsAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listSyncDatabaseIdsSinglePageAsync(locationName, context), + nextLink -> listSyncDatabaseIdsNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSyncDatabaseIds(String locationName) { + return new PagedIterable<>(listSyncDatabaseIdsAsync(locationName)); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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 collection of sync database ids. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSyncDatabaseIds(String locationName, Context context) { + return new PagedIterable<>(listSyncDatabaseIdsAsync(locationName, context)); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshHubSchemaWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .refreshHubSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshHubSchemaWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .refreshHubSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRefreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + Mono>> mono = + refreshHubSchemaWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRefreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + refreshHubSchemaWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName).getSyncPoller(); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .getSyncPoller(); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + refreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName).block(); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + refreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listHubSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHubSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHubSchemasAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedFlux<>( + () -> listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + nextLink -> listHubSchemasNextSinglePageAsync(nextLink)); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHubSchemasAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedFlux<>( + () -> listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, context), + nextLink -> listHubSchemasNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedIterable<>(listHubSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName)); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedIterable<>( + listHubSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName, context)); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @param continuationToken The continuation token for 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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listLogs( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @param continuationToken The continuation token for this operation. + * @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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listLogs( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @param continuationToken The continuation token for 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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLogsAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken) { + return new PagedFlux<>( + () -> + listLogsSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken), + nextLink -> listLogsNextSinglePageAsync(nextLink)); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLogsAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type) { + final String continuationToken = null; + return new PagedFlux<>( + () -> + listLogsSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken), + nextLink -> listLogsNextSinglePageAsync(nextLink)); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @param continuationToken The continuation token for this operation. + * @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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLogsAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context) { + return new PagedFlux<>( + () -> + listLogsSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + context), + nextLink -> listLogsNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type) { + final String continuationToken = null; + return new PagedIterable<>( + listLogsAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken)); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @param continuationToken The continuation token for this operation. + * @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 collection of sync group logs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context) { + return new PagedIterable<>( + listLogsAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + context)); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancelSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .cancelSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelSyncAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return cancelSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + cancelSyncAsync(resourceGroupName, serverName, databaseName, syncGroupName).block(); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return cancelSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> triggerSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .triggerSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> triggerSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .triggerSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerSyncAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return triggerSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + triggerSyncAsync(resourceGroupName, serverName, databaseName, syncGroupName).block(); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return triggerSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .block(); + } + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getAsync(resourceGroupName, serverName, databaseName, syncGroupName).block(); + } + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncGroupInner.class, SyncGroupInner.class, Context.NONE); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncGroupInner.class, SyncGroupInner.class, context); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).block(); + } + + /** + * Creates or updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .block(); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName).getSyncPoller(); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).getSyncPoller(); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName).block(); + } + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncGroupInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncGroupInner.class, SyncGroupInner.class, Context.NONE); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncGroupInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncGroupInner.class, SyncGroupInner.class, context); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).getSyncPoller(); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).block(); + } + + /** + * Updates a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @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 an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context).block(); + } + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + 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 sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @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 sync groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @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 sync groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @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 sync groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 sync database ID properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsNextSinglePageAsync(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.listSyncDatabaseIdsNext(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 sync database ID properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsNextSinglePageAsync( + 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 + .listSyncDatabaseIdsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync schema properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasNextSinglePageAsync(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.listHubSchemasNext(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 sync schema properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasNextSinglePageAsync( + 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 + .listHubSchemasNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync group log properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsNextSinglePageAsync(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.listLogsNext(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 sync group log properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsNextSinglePageAsync( + 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 + .listLogsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(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 sync groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.java new file mode 100644 index 0000000000000..cdad20655a538 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.SyncGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncDatabaseIdProperties; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaProperties; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogProperties; +import com.azure.resourcemanager.sql.generated.models.SyncGroups; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SyncGroupsImpl implements SyncGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupsImpl.class); + + private final SyncGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SyncGroupsImpl( + SyncGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listSyncDatabaseIds(String locationName) { + PagedIterable inner = this.serviceClient().listSyncDatabaseIds(locationName); + return Utils.mapPage(inner, inner1 -> new SyncDatabaseIdPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listSyncDatabaseIds(String locationName, Context context) { + PagedIterable inner = + this.serviceClient().listSyncDatabaseIds(locationName, context); + return Utils.mapPage(inner, inner1 -> new SyncDatabaseIdPropertiesImpl(inner1, this.manager())); + } + + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + this.serviceClient().refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + PagedIterable inner = + this.serviceClient().listHubSchemas(resourceGroupName, serverName, databaseName, syncGroupName); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listHubSchemas(resourceGroupName, serverName, databaseName, syncGroupName, context); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type) { + PagedIterable inner = + this + .serviceClient() + .listLogs(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type); + return Utils.mapPage(inner, inner1 -> new SyncGroupLogPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listLogs( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + context); + return Utils.mapPage(inner, inner1 -> new SyncGroupLogPropertiesImpl(inner1, this.manager())); + } + + public void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().cancelSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return this + .serviceClient() + .cancelSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().triggerSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return this + .serviceClient() + .triggerSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public SyncGroup get(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, syncGroupName); + if (inner != null) { + return new SyncGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SyncGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new SyncGroupImpl(inner1, this.manager())); + } + + public SyncGroup 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + private SyncGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SyncGroupImpl define(String name) { + return new SyncGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.java new file mode 100644 index 0000000000000..2ab6ba35fa681 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.azure.resourcemanager.sql.generated.models.SyncMemberState; +import java.util.UUID; + +public final class SyncMemberImpl implements SyncMember, SyncMember.Definition, SyncMember.Update { + private SyncMemberInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SyncMemberDbType databaseType() { + return this.innerModel().databaseType(); + } + + public String syncAgentId() { + return this.innerModel().syncAgentId(); + } + + public UUID sqlServerDatabaseId() { + return this.innerModel().sqlServerDatabaseId(); + } + + public String syncMemberAzureDatabaseResourceId() { + return this.innerModel().syncMemberAzureDatabaseResourceId(); + } + + public Boolean usePrivateLinkConnection() { + return this.innerModel().usePrivateLinkConnection(); + } + + public String privateEndpointName() { + return this.innerModel().privateEndpointName(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public SyncDirection syncDirection() { + return this.innerModel().syncDirection(); + } + + public SyncMemberState syncState() { + return this.innerModel().syncState(); + } + + public SyncMemberInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String syncGroupName; + + private String syncMemberName; + + public SyncMemberImpl withExistingSyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.syncGroupName = syncGroupName; + return this; + } + + public SyncMember create() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + Context.NONE); + return this; + } + + public SyncMember create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + context); + return this; + } + + SyncMemberImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SyncMemberInner(); + this.serviceManager = serviceManager; + this.syncMemberName = name; + } + + public SyncMemberImpl update() { + return this; + } + + public SyncMember apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .update( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + Context.NONE); + return this; + } + + public SyncMember apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .update( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + context); + return this; + } + + SyncMemberImpl(SyncMemberInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.syncGroupName = Utils.getValueFromIdByName(innerObject.id(), "syncGroups"); + this.syncMemberName = Utils.getValueFromIdByName(innerObject.id(), "syncMembers"); + } + + public SyncMember refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .getWithResponse( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, Context.NONE) + .getValue(); + return this; + } + + public SyncMember refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .getValue(); + return this; + } + + public SyncMemberImpl withDatabaseType(SyncMemberDbType databaseType) { + this.innerModel().withDatabaseType(databaseType); + return this; + } + + public SyncMemberImpl withSyncAgentId(String syncAgentId) { + this.innerModel().withSyncAgentId(syncAgentId); + return this; + } + + public SyncMemberImpl withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.innerModel().withSqlServerDatabaseId(sqlServerDatabaseId); + return this; + } + + public SyncMemberImpl withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId) { + this.innerModel().withSyncMemberAzureDatabaseResourceId(syncMemberAzureDatabaseResourceId); + return this; + } + + public SyncMemberImpl withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.innerModel().withUsePrivateLinkConnection(usePrivateLinkConnection); + return this; + } + + public SyncMemberImpl withServerName(String serverName) { + this.innerModel().withServerName(serverName); + return this; + } + + public SyncMemberImpl withDatabaseName(String databaseName) { + this.innerModel().withDatabaseName(databaseName); + return this; + } + + public SyncMemberImpl withUsername(String username) { + this.innerModel().withUsername(username); + return this; + } + + public SyncMemberImpl withPassword(String password) { + this.innerModel().withPassword(password); + return this; + } + + public SyncMemberImpl withSyncDirection(SyncDirection syncDirection) { + this.innerModel().withSyncDirection(syncDirection); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java new file mode 100644 index 0000000000000..f6db6aa86b0c8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java @@ -0,0 +1,2492 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.SyncMembersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaPropertiesListResult; +import com.azure.resourcemanager.sql.generated.models.SyncMemberListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SyncMembersClient. */ +public final class SyncMembersClientImpl implements SyncMembersClient { + private final ClientLogger logger = new ClientLogger(SyncMembersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SyncMembersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncMembersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SyncMembersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SyncMembersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSyncMembers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface SyncMembersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncMemberInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncMemberInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySyncGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}" + + "/schemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMemberSchemas( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}" + + "/refreshSchema") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> refreshMemberSchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySyncGroupNext( + @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> listMemberSchemasNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).block(); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .block(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncMemberInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncMemberInner.class, SyncMemberInner.class, Context.NONE); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncMemberInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncMemberInner.class, SyncMemberInner.class, context); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .block(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .block(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .getSyncPoller(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .getSyncPoller(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String databaseName, String syncGroupName, String syncMemberName) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).block(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context).block(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncMemberInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncMemberInner.class, SyncMemberInner.class, Context.NONE); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SyncMemberInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncMemberInner.class, SyncMemberInner.class, context); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .getSyncPoller(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .block(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @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 an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return updateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .block(); + } + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySyncGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + 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 sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySyncGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySyncGroupAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedFlux<>( + () -> listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + nextLink -> listBySyncGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySyncGroupAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedFlux<>( + () -> listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, context), + nextLink -> listBySyncGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedIterable<>(listBySyncGroupAsync(resourceGroupName, serverName, databaseName, syncGroupName)); + } + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedIterable<>( + listBySyncGroupAsync(resourceGroupName, serverName, databaseName, syncGroupName, context)); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMemberSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMemberSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMemberSchemasAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return new PagedFlux<>( + () -> + listMemberSchemasSinglePageAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), + nextLink -> listMemberSchemasNextSinglePageAsync(nextLink)); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMemberSchemasAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return new PagedFlux<>( + () -> + listMemberSchemasSinglePageAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context), + nextLink -> listMemberSchemasNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMemberSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return new PagedIterable<>( + listMemberSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName)); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member database schema. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return new PagedIterable<>( + listMemberSchemasAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context)); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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>> refreshMemberSchemaWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .refreshMemberSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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>> refreshMemberSchemaWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .refreshMemberSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRefreshMemberSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + Mono>> mono = + refreshMemberSchemaWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRefreshMemberSchemaAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + refreshMemberSchemaWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginRefreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .getSyncPoller(); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginRefreshMemberSchemaAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .getSyncPoller(); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 refreshMemberSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginRefreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 refreshMemberSchemaAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginRefreshMemberSchemaAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + refreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).block(); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + refreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupNextSinglePageAsync(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.listBySyncGroupNext(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 Azure SQL Database sync members. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupNextSinglePageAsync(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 + .listBySyncGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync schema properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasNextSinglePageAsync(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.listMemberSchemasNext(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 sync schema properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasNextSinglePageAsync( + 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 + .listMemberSchemasNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java new file mode 100644 index 0000000000000..ffd220f26a1a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.SyncMembersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaProperties; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMembers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SyncMembersImpl implements SyncMembers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncMembersImpl.class); + + private final SyncMembersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SyncMembersImpl( + SyncMembersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SyncMember get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMemberInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + if (inner != null) { + return new SyncMemberImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncMemberImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + PagedIterable inner = + this.serviceClient().listBySyncGroup(resourceGroupName, serverName, databaseName, syncGroupName); + return Utils.mapPage(inner, inner1 -> new SyncMemberImpl(inner1, this.manager())); + } + + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listBySyncGroup(resourceGroupName, serverName, databaseName, syncGroupName, context); + return Utils.mapPage(inner, inner1 -> new SyncMemberImpl(inner1, this.manager())); + } + + public PagedIterable listMemberSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + PagedIterable inner = + this + .serviceClient() + .listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public void refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + this + .serviceClient() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + } + + public void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + this + .serviceClient() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + public SyncMember 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + private SyncMembersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SyncMemberImpl define(String name) { + return new SyncMemberImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java new file mode 100644 index 0000000000000..b11c724a41f55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.TdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TdeCertificatesClient. */ +public final class TdeCertificatesClientImpl implements TdeCertificatesClient { + private final ClientLogger logger = new ClientLogger(TdeCertificatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TdeCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of TdeCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TdeCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(TdeCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientTdeCertificates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientT") + private interface TdeCertificatesService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/tdeCertificates") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TdeCertificate parameters, + Context context); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, TdeCertificate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2017-10-01-preview"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, TdeCertificate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 apiVersion = "2017-10-01-preview"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String serverName, TdeCertificate parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String serverName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String resourceGroupName, String serverName, TdeCertificate parameters) { + createAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + createAsync(resourceGroupName, serverName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.java new file mode 100644 index 0000000000000..627f32a039fe8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.TdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; +import com.azure.resourcemanager.sql.generated.models.TdeCertificates; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TdeCertificatesImpl implements TdeCertificates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TdeCertificatesImpl.class); + + private final TdeCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public TdeCertificatesImpl( + TdeCertificatesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void create(String resourceGroupName, String serverName, TdeCertificate parameters) { + this.serviceClient().create(resourceGroupName, serverName, parameters); + } + + public void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + this.serviceClient().create(resourceGroupName, serverName, parameters, context); + } + + private TdeCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TopQueriesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TopQueriesImpl.java new file mode 100644 index 0000000000000..414d9b2a59003 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TopQueriesImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.QueryStatisticsProperties; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.TopQueries; +import java.util.Collections; +import java.util.List; + +public final class TopQueriesImpl implements TopQueries { + private TopQueriesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + TopQueriesImpl(TopQueriesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer numberOfQueries() { + return this.innerModel().numberOfQueries(); + } + + public String aggregationFunction() { + return this.innerModel().aggregationFunction(); + } + + public String observationMetric() { + return this.innerModel().observationMetric(); + } + + public QueryTimeGrainType intervalType() { + return this.innerModel().intervalType(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public List queries() { + List inner = this.innerModel().queries(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TopQueriesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivitiesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivitiesClientImpl.java new file mode 100644 index 0000000000000..32a5cecf01b5e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivitiesClientImpl.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.TransparentDataEncryptionActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionActivityInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionActivityListResult; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TransparentDataEncryptionActivitiesClient. + */ +public final class TransparentDataEncryptionActivitiesClientImpl implements TransparentDataEncryptionActivitiesClient { + private final ClientLogger logger = new ClientLogger(TransparentDataEncryptionActivitiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TransparentDataEncryptionActivitiesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionActivitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TransparentDataEncryptionActivitiesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + TransparentDataEncryptionActivitiesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientTransparentDataEncryptionActivities to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientT") + private interface TransparentDataEncryptionActivitiesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}" + + "/operationResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByConfiguration( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("transparentDataEncryptionName") TransparentDataEncryptionName transparentDataEncryptionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByConfigurationSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (transparentDataEncryptionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter transparentDataEncryptionName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByConfiguration( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByConfigurationSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (transparentDataEncryptionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter transparentDataEncryptionName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByConfiguration( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByConfigurationAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + return new PagedFlux<>( + () -> + listByConfigurationSinglePageAsync( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName)); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByConfigurationAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context) { + return new PagedFlux<>( + () -> + listByConfigurationSinglePageAsync( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName, context)); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + return new PagedIterable<>( + listByConfigurationAsync(resourceGroupName, serverName, databaseName, transparentDataEncryptionName)); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 represents the response to a list database transparent data encryption activity request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context) { + return new PagedIterable<>( + listByConfigurationAsync( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivitiesImpl.java new file mode 100644 index 0000000000000..b8d89bc7a6c80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivitiesImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.TransparentDataEncryptionActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionActivityInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionActivities; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionActivity; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TransparentDataEncryptionActivitiesImpl implements TransparentDataEncryptionActivities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransparentDataEncryptionActivitiesImpl.class); + + private final TransparentDataEncryptionActivitiesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public TransparentDataEncryptionActivitiesImpl( + TransparentDataEncryptionActivitiesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + PagedIterable inner = + this + .serviceClient() + .listByConfiguration(resourceGroupName, serverName, databaseName, transparentDataEncryptionName); + return Utils.mapPage(inner, inner1 -> new TransparentDataEncryptionActivityImpl(inner1, this.manager())); + } + + public PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByConfiguration( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName, context); + return Utils.mapPage(inner, inner1 -> new TransparentDataEncryptionActivityImpl(inner1, this.manager())); + } + + private TransparentDataEncryptionActivitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivityImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivityImpl.java new file mode 100644 index 0000000000000..ce78694adf385 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionActivityImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionActivityInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionActivity; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionActivityStatus; + +public final class TransparentDataEncryptionActivityImpl implements TransparentDataEncryptionActivity { + private TransparentDataEncryptionActivityInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + TransparentDataEncryptionActivityImpl( + TransparentDataEncryptionActivityInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public TransparentDataEncryptionActivityStatus status() { + return this.innerModel().status(); + } + + public Float percentComplete() { + return this.innerModel().percentComplete(); + } + + public TransparentDataEncryptionActivityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..b40a7e529deb9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionStatus; + +public final class TransparentDataEncryptionImpl + implements TransparentDataEncryption, TransparentDataEncryption.Definition, TransparentDataEncryption.Update { + private TransparentDataEncryptionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager 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 TransparentDataEncryptionStatus status() { + return this.innerModel().status(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public TransparentDataEncryptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private TransparentDataEncryptionName transparentDataEncryptionName; + + public TransparentDataEncryptionImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public TransparentDataEncryption create() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public TransparentDataEncryption create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + this.innerModel(), + context) + .getValue(); + return this; + } + + TransparentDataEncryptionImpl( + TransparentDataEncryptionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new TransparentDataEncryptionInner(); + this.serviceManager = serviceManager; + this.transparentDataEncryptionName = name; + } + + public TransparentDataEncryptionImpl update() { + return this; + } + + public TransparentDataEncryption apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public TransparentDataEncryption apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + this.innerModel(), + context) + .getValue(); + return this; + } + + TransparentDataEncryptionImpl( + TransparentDataEncryptionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.transparentDataEncryptionName = + TransparentDataEncryptionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "transparentDataEncryption")); + } + + public TransparentDataEncryption refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .getWithResponse( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName, Context.NONE) + .getValue(); + return this; + } + + public TransparentDataEncryption refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .getWithResponse(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, context) + .getValue(); + return this; + } + + public TransparentDataEncryptionImpl withStatus(TransparentDataEncryptionStatus status) { + this.innerModel().withStatus(status); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java new file mode 100644 index 0000000000000..21ee8805efdff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java @@ -0,0 +1,539 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.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.sql.generated.fluent.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TransparentDataEncryptionsClient. */ +public final class TransparentDataEncryptionsClientImpl implements TransparentDataEncryptionsClient { + private final ClientLogger logger = new ClientLogger(TransparentDataEncryptionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TransparentDataEncryptionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TransparentDataEncryptionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + TransparentDataEncryptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientTransparentDataEncryptions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientT") + private interface TransparentDataEncryptionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("transparentDataEncryptionName") TransparentDataEncryptionName transparentDataEncryptionName, + @BodyParam("application/json") TransparentDataEncryptionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("transparentDataEncryptionName") TransparentDataEncryptionName transparentDataEncryptionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @param parameters The required parameters for creating or updating transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + TransparentDataEncryptionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (transparentDataEncryptionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter transparentDataEncryptionName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @param parameters The required parameters for creating or updating transparent data encryption. + * @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 represents a database transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + TransparentDataEncryptionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (transparentDataEncryptionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter transparentDataEncryptionName 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 apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @param parameters The required parameters for creating or updating transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + TransparentDataEncryptionInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @param parameters The required parameters for creating or updating transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + TransparentDataEncryptionInner parameters) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName, parameters) + .block(); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @param parameters The required parameters for creating or updating transparent data encryption. + * @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 represents a database transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + TransparentDataEncryptionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, transparentDataEncryptionName, parameters, context) + .block(); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (transparentDataEncryptionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter transparentDataEncryptionName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 database's transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (transparentDataEncryptionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter transparentDataEncryptionName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + transparentDataEncryptionName, + accept, + context); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, transparentDataEncryptionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 database's transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransparentDataEncryptionInner get( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + return getAsync(resourceGroupName, serverName, databaseName, transparentDataEncryptionName).block(); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 database's transparent data encryption configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.java new file mode 100644 index 0000000000000..0b81d8f811036 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TransparentDataEncryptionsImpl implements TransparentDataEncryptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransparentDataEncryptionsImpl.class); + + private final TransparentDataEncryptionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public TransparentDataEncryptionsImpl( + TransparentDataEncryptionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TransparentDataEncryption get( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName) { + TransparentDataEncryptionInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, transparentDataEncryptionName); + if (inner != null) { + return new TransparentDataEncryptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TransparentDataEncryptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TransparentDataEncryption 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + TransparentDataEncryptionName transparentDataEncryptionName = + TransparentDataEncryptionName.fromString(Utils.getValueFromIdByName(id, "transparentDataEncryption")); + if (transparentDataEncryptionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + TransparentDataEncryptionName transparentDataEncryptionName = + TransparentDataEncryptionName.fromString(Utils.getValueFromIdByName(id, "transparentDataEncryption")); + if (transparentDataEncryptionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, context); + } + + private TransparentDataEncryptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public TransparentDataEncryptionImpl define(TransparentDataEncryptionName name) { + return new TransparentDataEncryptionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsageImpl.java new file mode 100644 index 0000000000000..ad49a8d6b6754 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsageImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.sql.generated.models.Name; +import com.azure.resourcemanager.sql.generated.models.Usage; + +public final class UsageImpl implements Usage { + private UsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + UsageImpl(UsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Name name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public Integer currentValue() { + return this.innerModel().currentValue(); + } + + public Integer limit() { + return this.innerModel().limit(); + } + + public Integer requestedLimit() { + return this.innerModel().requestedLimit(); + } + + public UsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.java new file mode 100644 index 0000000000000..2295460ff8e62 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.UsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.sql.generated.models.UsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public final class UsagesClientImpl implements UsagesClient { + private final ClientLogger logger = new ClientLogger(UsagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final UsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of UsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsagesClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(UsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientUsages to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientU") + private interface UsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstancePool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @QueryParam("expandChildren") Boolean expandChildren, + @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> listByInstancePoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren) { + 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expandChildren, + this.client.getSubscriptionId(), + apiVersion, + 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 instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren, 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 (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expandChildren, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync(String resourceGroupName, String instancePoolName) { + final Boolean expandChildren = null; + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren, context), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + final Boolean expandChildren = null; + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName, expandChildren)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context) { + return new PagedIterable<>( + listByInstancePoolAsync(resourceGroupName, instancePoolName, expandChildren, 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 usages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync(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.listByInstancePoolNext(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 usages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync(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 + .listByInstancePoolNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.java new file mode 100644 index 0000000000000..0d441c8cd28fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.UsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.sql.generated.models.Usage; +import com.azure.resourcemanager.sql.generated.models.Usages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class UsagesImpl implements Usages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsagesImpl.class); + + private final UsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public UsagesImpl(UsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + PagedIterable inner = this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context) { + PagedIterable inner = + this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName, expandChildren, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + private UsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/Utils.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/Utils.java new file mode 100644 index 0000000000000..325c85d1c949d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.java new file mode 100644 index 0000000000000..adae5e30f07ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.VirtualCluster; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualClusterImpl implements VirtualCluster { + private VirtualClusterInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + VirtualClusterImpl( + VirtualClusterInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String subnetId() { + return this.innerModel().subnetId(); + } + + public String family() { + return this.innerModel().family(); + } + + public List childResources() { + List inner = this.innerModel().childResources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualClusterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java new file mode 100644 index 0000000000000..a7623d983ff07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java @@ -0,0 +1,1286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.VirtualClustersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterListResult; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualClustersClient. */ +public final class VirtualClustersClientImpl implements VirtualClustersClient { + private final ClientLogger logger = new ClientLogger(VirtualClustersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualClustersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualClustersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(VirtualClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientVirtualClusters to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientV") + private interface VirtualClustersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/virtualClusters") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualClusterName") String virtualClusterName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualClusterName") String virtualClusterName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualClusterName") String virtualClusterName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualClusterUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters 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 a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualClusterName) { + 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 (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualClusterName, 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 (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualClusterName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualClusterInner getByResourceGroup(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupAsync(resourceGroupName, virtualClusterName).block(); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualClusterName, context).block(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtualClusterName) { + 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 (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, 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 (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualClusterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualClusterName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualClusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualClusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualClusterName) { + return beginDeleteAsync(resourceGroupName, virtualClusterName).getSyncPoller(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualClusterName, Context context) { + return beginDeleteAsync(resourceGroupName, virtualClusterName, context).getSyncPoller(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtualClusterName) { + return beginDeleteAsync(resourceGroupName, virtualClusterName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualClusterName, Context context) { + return beginDeleteAsync(resourceGroupName, virtualClusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualClusterName) { + deleteAsync(resourceGroupName, virtualClusterName).block(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualClusterName, Context context) { + deleteAsync(resourceGroupName, virtualClusterName, context).block(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate 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 (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate 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 (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualClusterInner> beginUpdateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualClusterName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualClusterInner.class, + VirtualClusterInner.class, + Context.NONE); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualClusterInner> beginUpdateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualClusterName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualClusterInner.class, VirtualClusterInner.class, context); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters).getSyncPoller(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters, context).getSyncPoller(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualClusterInner update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return updateAsync(resourceGroupName, virtualClusterName, parameters).block(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualClusterInner update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + return updateAsync(resourceGroupName, virtualClusterName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters. + */ + @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 a list of virtual clusters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters. + */ + @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 virtual clusters. + */ + @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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.java new file mode 100644 index 0000000000000..f624c78ee14c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.VirtualClustersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.VirtualCluster; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; +import com.azure.resourcemanager.sql.generated.models.VirtualClusters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualClustersImpl implements VirtualClusters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualClustersImpl.class); + + private final VirtualClustersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public VirtualClustersImpl( + VirtualClustersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public VirtualCluster getByResourceGroup(String resourceGroupName, String virtualClusterName) { + VirtualClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, virtualClusterName); + if (inner != null) { + return new VirtualClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, virtualClusterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualClusterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String virtualClusterName) { + this.serviceClient().delete(resourceGroupName, virtualClusterName); + } + + public void delete(String resourceGroupName, String virtualClusterName, Context context) { + this.serviceClient().delete(resourceGroupName, virtualClusterName, context); + } + + public VirtualCluster update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + VirtualClusterInner inner = this.serviceClient().update(resourceGroupName, virtualClusterName, parameters); + if (inner != null) { + return new VirtualClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualCluster update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + VirtualClusterInner inner = + this.serviceClient().update(resourceGroupName, virtualClusterName, parameters, context); + if (inner != null) { + return new VirtualClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + private VirtualClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 0000000000000..b38f45c7eb1f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRuleImpl.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.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRule; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleState; + +public final class VirtualNetworkRuleImpl + implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private VirtualNetworkRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String virtualNetworkSubnetId() { + return this.innerModel().virtualNetworkSubnetId(); + } + + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.innerModel().ignoreMissingVnetServiceEndpoint(); + } + + public VirtualNetworkRuleState state() { + return this.innerModel().state(); + } + + public VirtualNetworkRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String virtualNetworkRuleName; + + public VirtualNetworkRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public VirtualNetworkRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new VirtualNetworkRuleInner(); + this.serviceManager = serviceManager; + this.virtualNetworkRuleName = name; + } + + public VirtualNetworkRuleImpl update() { + return this; + } + + public VirtualNetworkRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl( + VirtualNetworkRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.virtualNetworkRuleName = Utils.getValueFromIdByName(innerObject.id(), "virtualNetworkRules"); + } + + public VirtualNetworkRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetworkRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context) + .getValue(); + return this; + } + + public VirtualNetworkRuleImpl withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.innerModel().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + public VirtualNetworkRuleImpl withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.innerModel().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java new file mode 100644 index 0000000000000..92516cd8bb05d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java @@ -0,0 +1,1183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public final class VirtualNetworkRulesClientImpl implements VirtualNetworkRulesClient { + private final ClientLogger logger = new ClientLogger(VirtualNetworkRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualNetworkRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworkRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(VirtualNetworkRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientVirtualNetworkRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientV") + private interface VirtualNetworkRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @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.Sql/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualNetworkRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/virtualNetworkRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName 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 apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + Context.NONE); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String virtualNetworkRuleName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 serverName, String virtualNetworkRuleName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String virtualNetworkRuleName) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 virtual network rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(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 virtual network rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 0000000000000..3529babcb2ab0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRule; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRulesImpl.class); + + private final VirtualNetworkRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public VirtualNetworkRulesImpl( + VirtualNetworkRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, virtualNetworkRuleName); + if (inner != null) { + return new VirtualNetworkRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName); + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + } + + public VirtualNetworkRule 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + private VirtualNetworkRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public VirtualNetworkRuleImpl define(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VulnerabilityAssessmentScanRecordImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..06c06262d4901 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecord; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class VulnerabilityAssessmentScanRecordImpl implements VulnerabilityAssessmentScanRecord { + private VulnerabilityAssessmentScanRecordInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + VulnerabilityAssessmentScanRecordImpl( + VulnerabilityAssessmentScanRecordInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String scanId() { + return this.innerModel().scanId(); + } + + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.innerModel().triggerType(); + } + + public VulnerabilityAssessmentScanState state() { + return this.innerModel().state(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public List errors() { + List inner = this.innerModel().errors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public Integer numberOfFailedSecurityChecks() { + return this.innerModel().numberOfFailedSecurityChecks(); + } + + public VulnerabilityAssessmentScanRecordInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifierImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifierImpl.java new file mode 100644 index 0000000000000..bfb153bc112eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifierImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifier; + +public final class WorkloadClassifierImpl + implements WorkloadClassifier, WorkloadClassifier.Definition, WorkloadClassifier.Update { + private WorkloadClassifierInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String memberName() { + return this.innerModel().memberName(); + } + + public String label() { + return this.innerModel().label(); + } + + public String context() { + return this.innerModel().context(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public String importance() { + return this.innerModel().importance(); + } + + public WorkloadClassifierInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String workloadGroupName; + + private String workloadClassifierName; + + public WorkloadClassifierImpl withExistingWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.workloadGroupName = workloadGroupName; + return this; + } + + public WorkloadClassifier create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + Context.NONE); + return this; + } + + public WorkloadClassifier create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + context); + return this; + } + + WorkloadClassifierImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new WorkloadClassifierInner(); + this.serviceManager = serviceManager; + this.workloadClassifierName = name; + } + + public WorkloadClassifierImpl update() { + return this; + } + + public WorkloadClassifier apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + Context.NONE); + return this; + } + + public WorkloadClassifier apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + context); + return this; + } + + WorkloadClassifierImpl( + WorkloadClassifierInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.workloadGroupName = Utils.getValueFromIdByName(innerObject.id(), "workloadGroups"); + this.workloadClassifierName = Utils.getValueFromIdByName(innerObject.id(), "workloadClassifiers"); + } + + public WorkloadClassifier refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + Context.NONE) + .getValue(); + return this; + } + + public WorkloadClassifier refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .getValue(); + return this; + } + + public WorkloadClassifierImpl withMemberName(String memberName) { + this.innerModel().withMemberName(memberName); + return this; + } + + public WorkloadClassifierImpl withLabel(String label) { + this.innerModel().withLabel(label); + return this; + } + + public WorkloadClassifierImpl withContext(String context) { + this.innerModel().withContext(context); + return this; + } + + public WorkloadClassifierImpl withStartTime(String startTime) { + this.innerModel().withStartTime(startTime); + return this; + } + + public WorkloadClassifierImpl withEndTime(String endTime) { + this.innerModel().withEndTime(endTime); + return this; + } + + public WorkloadClassifierImpl withImportance(String importance) { + this.innerModel().withImportance(importance); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java new file mode 100644 index 0000000000000..25df887a80867 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java @@ -0,0 +1,1470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadClassifiersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifierListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkloadClassifiersClient. */ +public final class WorkloadClassifiersClientImpl implements WorkloadClassifiersClient { + private final ClientLogger logger = new ClientLogger(WorkloadClassifiersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkloadClassifiersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of WorkloadClassifiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadClassifiersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(WorkloadClassifiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientWorkloadClassifiers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientW") + private interface WorkloadClassifiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers" + + "/{workloadClassifierName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("workloadClassifierName") String workloadClassifierName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers" + + "/{workloadClassifierName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("workloadClassifierName") String workloadClassifierName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") WorkloadClassifierInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers" + + "/{workloadClassifierName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("workloadClassifierName") String workloadClassifierName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkloadGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @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> listByWorkloadGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @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 workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadClassifierInner get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return getAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName).block(); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @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 workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .block(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, WorkloadClassifierInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkloadClassifierInner.class, + WorkloadClassifierInner.class, + Context.NONE); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, WorkloadClassifierInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkloadClassifierInner.class, + WorkloadClassifierInner.class, + context); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters) + .block(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @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 workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context) + .block(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @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 serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName) + .getSyncPoller(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + return beginDeleteAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .getSyncPoller(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + return beginDeleteAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName).block(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .block(); + } + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByWorkloadGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkloadGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkloadGroupAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return new PagedFlux<>( + () -> listByWorkloadGroupSinglePageAsync(resourceGroupName, serverName, databaseName, workloadGroupName), + nextLink -> listByWorkloadGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkloadGroupAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return new PagedFlux<>( + () -> + listByWorkloadGroupSinglePageAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, context), + nextLink -> listByWorkloadGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return new PagedIterable<>( + listByWorkloadGroupAsync(resourceGroupName, serverName, databaseName, workloadGroupName)); + } + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return new PagedIterable<>( + listByWorkloadGroupAsync(resourceGroupName, serverName, databaseName, workloadGroupName, 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 workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupNextSinglePageAsync(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.listByWorkloadGroupNext(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 workload classifiers for a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupNextSinglePageAsync( + 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 + .listByWorkloadGroupNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java new file mode 100644 index 0000000000000..b3ac739be685e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.WorkloadClassifiersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifier; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifiers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkloadClassifiersImpl implements WorkloadClassifiers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkloadClassifiersImpl.class); + + private final WorkloadClassifiersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public WorkloadClassifiersImpl( + WorkloadClassifiersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public WorkloadClassifier get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + WorkloadClassifierInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName); + if (inner != null) { + return new WorkloadClassifierImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkloadClassifierImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + } + + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + PagedIterable inner = + this.serviceClient().listByWorkloadGroup(resourceGroupName, serverName, databaseName, workloadGroupName); + return Utils.mapPage(inner, inner1 -> new WorkloadClassifierImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByWorkloadGroup(resourceGroupName, serverName, databaseName, workloadGroupName, context); + return Utils.mapPage(inner, inner1 -> new WorkloadClassifierImpl(inner1, this.manager())); + } + + public WorkloadClassifier 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + return this + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + return this + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + this + .delete( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + } + + private WorkloadClassifiersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public WorkloadClassifierImpl define(String name) { + return new WorkloadClassifierImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupImpl.java new file mode 100644 index 0000000000000..d174615f199f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroup; + +public final class WorkloadGroupImpl implements WorkloadGroup, WorkloadGroup.Definition, WorkloadGroup.Update { + private WorkloadGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer minResourcePercent() { + return this.innerModel().minResourcePercent(); + } + + public Integer maxResourcePercent() { + return this.innerModel().maxResourcePercent(); + } + + public Double minResourcePercentPerRequest() { + return this.innerModel().minResourcePercentPerRequest(); + } + + public Double maxResourcePercentPerRequest() { + return this.innerModel().maxResourcePercentPerRequest(); + } + + public String importance() { + return this.innerModel().importance(); + } + + public Integer queryExecutionTimeout() { + return this.innerModel().queryExecutionTimeout(); + } + + public WorkloadGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String workloadGroupName; + + public WorkloadGroupImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public WorkloadGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), Context.NONE); + return this; + } + + public WorkloadGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), context); + return this; + } + + WorkloadGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new WorkloadGroupInner(); + this.serviceManager = serviceManager; + this.workloadGroupName = name; + } + + public WorkloadGroupImpl update() { + return this; + } + + public WorkloadGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), Context.NONE); + return this; + } + + public WorkloadGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), context); + return this; + } + + WorkloadGroupImpl( + WorkloadGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.workloadGroupName = Utils.getValueFromIdByName(innerObject.id(), "workloadGroups"); + } + + public WorkloadGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, Context.NONE) + .getValue(); + return this; + } + + public WorkloadGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, context) + .getValue(); + return this; + } + + public WorkloadGroupImpl withMinResourcePercent(Integer minResourcePercent) { + this.innerModel().withMinResourcePercent(minResourcePercent); + return this; + } + + public WorkloadGroupImpl withMaxResourcePercent(Integer maxResourcePercent) { + this.innerModel().withMaxResourcePercent(maxResourcePercent); + return this; + } + + public WorkloadGroupImpl withMinResourcePercentPerRequest(Double minResourcePercentPerRequest) { + this.innerModel().withMinResourcePercentPerRequest(minResourcePercentPerRequest); + return this; + } + + public WorkloadGroupImpl withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest) { + this.innerModel().withMaxResourcePercentPerRequest(maxResourcePercentPerRequest); + return this; + } + + public WorkloadGroupImpl withImportance(String importance) { + this.innerModel().withImportance(importance); + return this; + } + + public WorkloadGroupImpl withQueryExecutionTimeout(Integer queryExecutionTimeout) { + this.innerModel().withQueryExecutionTimeout(queryExecutionTimeout); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java new file mode 100644 index 0000000000000..1f6b5674265ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java @@ -0,0 +1,1256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkloadGroupsClient. */ +public final class WorkloadGroupsClientImpl implements WorkloadGroupsClient { + private final ClientLogger logger = new ClientLogger(WorkloadGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkloadGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of WorkloadGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(WorkloadGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientWorkloadGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientW") + private interface WorkloadGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @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.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") WorkloadGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @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> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadGroupInner get( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return getAsync(resourceGroupName, serverName, databaseName, workloadGroupName).block(); + } + + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context).block(); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName 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 apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, WorkloadGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), WorkloadGroupInner.class, WorkloadGroupInner.class, Context.NONE); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, WorkloadGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), WorkloadGroupInner.class, WorkloadGroupInner.class, context); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters).block(); + } + + /** + * Creates or updates a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @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 workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context) + .block(); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String workloadGroupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @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 serverName, String databaseName, String workloadGroupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName).getSyncPoller(); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context) + .getSyncPoller(); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 serverName, String databaseName, String workloadGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String databaseName, String workloadGroupName) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName).block(); + } + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context).block(); + } + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 workload groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(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.listByDatabaseNext(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 workload groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + 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 + .listByDatabaseNext(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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.java new file mode 100644 index 0000000000000..757e4d193080b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.WorkloadGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroup; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkloadGroupsImpl implements WorkloadGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkloadGroupsImpl.class); + + private final WorkloadGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public WorkloadGroupsImpl( + WorkloadGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public WorkloadGroup get( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + WorkloadGroupInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, workloadGroupName); + if (inner != null) { + return new WorkloadGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkloadGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, workloadGroupName); + } + + public void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, workloadGroupName, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new WorkloadGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new WorkloadGroupImpl(inner1, this.manager())); + } + + public WorkloadGroup 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, workloadGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, workloadGroupName, context); + } + + private WorkloadGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public WorkloadGroupImpl define(String name) { + return new WorkloadGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/package-info.java new file mode 100644 index 0000000000000..9b53ba196ce85 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 SqlManagementClient. The Azure SQL Database management API provides a + * RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables + * you to create, retrieve, update, and delete databases. + */ +package com.azure.resourcemanager.sql.generated.implementation; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.java new file mode 100644 index 0000000000000..d31a40cb6db77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory administrators. */ +@Immutable +public final class AdministratorListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdministratorListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorName.java new file mode 100644 index 0000000000000..865876e13fe16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AdministratorName. */ +public final class AdministratorName extends ExpandableStringEnum { + /** Static value ActiveDirectory for AdministratorName. */ + public static final AdministratorName ACTIVE_DIRECTORY = fromString("ActiveDirectory"); + + /** + * Creates or finds a AdministratorName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdministratorName. + */ + @JsonCreator + public static AdministratorName fromString(String name) { + return fromString(name, AdministratorName.class); + } + + /** @return known AdministratorName values. */ + public static Collection values() { + return values(AdministratorName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorType.java new file mode 100644 index 0000000000000..6de94b25f5bb2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AdministratorType. */ +public final class AdministratorType extends ExpandableStringEnum { + /** Static value ActiveDirectory for AdministratorType. */ + public static final AdministratorType ACTIVE_DIRECTORY = fromString("ActiveDirectory"); + + /** + * Creates or finds a AdministratorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdministratorType. + */ + @JsonCreator + public static AdministratorType fromString(String name) { + return fromString(name, AdministratorType.class); + } + + /** @return known AdministratorType values. */ + public static Collection values() { + return values(AdministratorType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AggregationFunctionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AggregationFunctionType.java new file mode 100644 index 0000000000000..72e65094a0060 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AggregationFunctionType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AggregationFunctionType. */ +public final class AggregationFunctionType extends ExpandableStringEnum { + /** Static value avg for AggregationFunctionType. */ + public static final AggregationFunctionType AVG = fromString("avg"); + + /** Static value min for AggregationFunctionType. */ + public static final AggregationFunctionType MIN = fromString("min"); + + /** Static value max for AggregationFunctionType. */ + public static final AggregationFunctionType MAX = fromString("max"); + + /** Static value stdev for AggregationFunctionType. */ + public static final AggregationFunctionType STDEV = fromString("stdev"); + + /** Static value sum for AggregationFunctionType. */ + public static final AggregationFunctionType SUM = fromString("sum"); + + /** + * Creates or finds a AggregationFunctionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AggregationFunctionType. + */ + @JsonCreator + public static AggregationFunctionType fromString(String name) { + return fromString(name, AggregationFunctionType.class); + } + + /** @return known AggregationFunctionType values. */ + public static Collection values() { + return values(AggregationFunctionType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AuthenticationName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AuthenticationName.java new file mode 100644 index 0000000000000..681334def0a8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AuthenticationName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthenticationName. */ +public final class AuthenticationName extends ExpandableStringEnum { + /** Static value Default for AuthenticationName. */ + public static final AuthenticationName DEFAULT = fromString("Default"); + + /** + * Creates or finds a AuthenticationName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationName. + */ + @JsonCreator + public static AuthenticationName fromString(String name) { + return fromString(name, AuthenticationName.class); + } + + /** @return known AuthenticationName values. */ + public static Collection values() { + return values(AuthenticationName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.java new file mode 100644 index 0000000000000..8a6723af3845b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Supported auto pause delay time range. */ +@Immutable +public final class AutoPauseDelayTimeRange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoPauseDelayTimeRange.class); + + /* + * Minimum value + */ + @JsonProperty(value = "minValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer minValue; + + /* + * Maximum value + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxValue; + + /* + * Step value for discrete values between the minimum value and the maximum + * value. + */ + @JsonProperty(value = "stepSize", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepSize; + + /* + * Default value is no value is provided + */ + @JsonProperty(value = "default", access = JsonProperty.Access.WRITE_ONLY) + private Integer defaultProperty; + + /* + * Unit of time that delay is expressed in + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PauseDelayTimeUnit unit; + + /* + * Value that is used to not pause (infinite delay before pause) + */ + @JsonProperty(value = "doNotPauseValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer doNotPauseValue; + + /** + * Get the minValue property: Minimum value. + * + * @return the minValue value. + */ + public Integer minValue() { + return this.minValue; + } + + /** + * Get the maxValue property: Maximum value. + * + * @return the maxValue value. + */ + public Integer maxValue() { + return this.maxValue; + } + + /** + * Get the stepSize property: Step value for discrete values between the minimum value and the maximum value. + * + * @return the stepSize value. + */ + public Integer stepSize() { + return this.stepSize; + } + + /** + * Get the defaultProperty property: Default value is no value is provided. + * + * @return the defaultProperty value. + */ + public Integer defaultProperty() { + return this.defaultProperty; + } + + /** + * Get the unit property: Unit of time that delay is expressed in. + * + * @return the unit value. + */ + public PauseDelayTimeUnit unit() { + return this.unit; + } + + /** + * Get the doNotPauseValue property: Value that is used to not pause (infinite delay before pause). + * + * @return the doNotPauseValue value. + */ + public Integer doNotPauseValue() { + return this.doNotPauseValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningDisabledReason.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningDisabledReason.java new file mode 100644 index 0000000000000..76bb05ae6412f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningDisabledReason.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AutomaticTuningDisabledReason. */ +public enum AutomaticTuningDisabledReason { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value AutoConfigured. */ + AUTO_CONFIGURED("AutoConfigured"), + + /** Enum value InheritedFromServer. */ + INHERITED_FROM_SERVER("InheritedFromServer"), + + /** Enum value QueryStoreOff. */ + QUERY_STORE_OFF("QueryStoreOff"), + + /** Enum value QueryStoreReadOnly. */ + QUERY_STORE_READ_ONLY("QueryStoreReadOnly"), + + /** Enum value NotSupported. */ + NOT_SUPPORTED("NotSupported"); + + /** The actual serialized value for a AutomaticTuningDisabledReason instance. */ + private final String value; + + AutomaticTuningDisabledReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningDisabledReason instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningDisabledReason object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningDisabledReason fromString(String value) { + AutomaticTuningDisabledReason[] items = AutomaticTuningDisabledReason.values(); + for (AutomaticTuningDisabledReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningMode.java new file mode 100644 index 0000000000000..f94d637a9fc12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningMode.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.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AutomaticTuningMode. */ +public enum AutomaticTuningMode { + /** Enum value Inherit. */ + INHERIT("Inherit"), + + /** Enum value Custom. */ + CUSTOM("Custom"), + + /** Enum value Auto. */ + AUTO("Auto"), + + /** Enum value Unspecified. */ + UNSPECIFIED("Unspecified"); + + /** The actual serialized value for a AutomaticTuningMode instance. */ + private final String value; + + AutomaticTuningMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningMode object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningMode fromString(String value) { + AutomaticTuningMode[] items = AutomaticTuningMode.values(); + for (AutomaticTuningMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeActual.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeActual.java new file mode 100644 index 0000000000000..ec9c981fea962 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeActual.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AutomaticTuningOptionModeActual. */ +public enum AutomaticTuningOptionModeActual { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"); + + /** The actual serialized value for a AutomaticTuningOptionModeActual instance. */ + private final String value; + + AutomaticTuningOptionModeActual(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeActual instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeActual object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeActual fromString(String value) { + AutomaticTuningOptionModeActual[] items = AutomaticTuningOptionModeActual.values(); + for (AutomaticTuningOptionModeActual item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeDesired.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeDesired.java new file mode 100644 index 0000000000000..4dd072854af4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeDesired.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AutomaticTuningOptionModeDesired. */ +public enum AutomaticTuningOptionModeDesired { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutomaticTuningOptionModeDesired instance. */ + private final String value; + + AutomaticTuningOptionModeDesired(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeDesired instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeDesired object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeDesired fromString(String value) { + AutomaticTuningOptionModeDesired[] items = AutomaticTuningOptionModeDesired.values(); + for (AutomaticTuningOptionModeDesired item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.java new file mode 100644 index 0000000000000..9fb331727d02b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Automatic tuning properties for individual advisors. */ +@Fluent +public final class AutomaticTuningOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomaticTuningOptions.class); + + /* + * Automatic tuning option desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /* + * Automatic tuning option actual state. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningOptionModeActual actualState; + + /* + * Reason code if desired and actual state are different. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer reasonCode; + + /* + * Reason description if desired and actual state are different. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningDisabledReason reasonDesc; + + /** + * Get the desiredState property: Automatic tuning option desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning option desired state. + * + * @param desiredState the desiredState value to set. + * @return the AutomaticTuningOptions object itself. + */ + public AutomaticTuningOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning option actual state. + * + * @return the actualState value. + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get the reasonCode property: Reason code if desired and actual state are different. + * + * @return the reasonCode value. + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get the reasonDesc property: Reason description if desired and actual state are different. + * + * @return the reasonDesc value. + */ + public AutomaticTuningDisabledReason reasonDesc() { + return this.reasonDesc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerMode.java new file mode 100644 index 0000000000000..572e645fd93ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerMode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AutomaticTuningServerMode. */ +public enum AutomaticTuningServerMode { + /** Enum value Custom. */ + CUSTOM("Custom"), + + /** Enum value Auto. */ + AUTO("Auto"), + + /** Enum value Unspecified. */ + UNSPECIFIED("Unspecified"); + + /** The actual serialized value for a AutomaticTuningServerMode instance. */ + private final String value; + + AutomaticTuningServerMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningServerMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningServerMode object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningServerMode fromString(String value) { + AutomaticTuningServerMode[] items = AutomaticTuningServerMode.values(); + for (AutomaticTuningServerMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.java new file mode 100644 index 0000000000000..c66085323f240 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Automatic tuning properties for individual advisors. */ +@Fluent +public final class AutomaticTuningServerOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomaticTuningServerOptions.class); + + /* + * Automatic tuning option desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /* + * Automatic tuning option actual state. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningOptionModeActual actualState; + + /* + * Reason code if desired and actual state are different. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer reasonCode; + + /* + * Reason description if desired and actual state are different. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerReason reasonDesc; + + /** + * Get the desiredState property: Automatic tuning option desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning option desired state. + * + * @param desiredState the desiredState value to set. + * @return the AutomaticTuningServerOptions object itself. + */ + public AutomaticTuningServerOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning option actual state. + * + * @return the actualState value. + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get the reasonCode property: Reason code if desired and actual state are different. + * + * @return the reasonCode value. + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get the reasonDesc property: Reason description if desired and actual state are different. + * + * @return the reasonDesc value. + */ + public AutomaticTuningServerReason reasonDesc() { + return this.reasonDesc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerReason.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerReason.java new file mode 100644 index 0000000000000..0435e1ba76a2f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerReason.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AutomaticTuningServerReason. */ +public enum AutomaticTuningServerReason { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value AutoConfigured. */ + AUTO_CONFIGURED("AutoConfigured"); + + /** The actual serialized value for a AutomaticTuningServerReason instance. */ + private final String value; + + AutomaticTuningServerReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningServerReason instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningServerReason object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningServerReason fromString(String value) { + AutomaticTuningServerReason[] items = AutomaticTuningServerReason.values(); + for (AutomaticTuningServerReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.java new file mode 100644 index 0000000000000..93c991ed5e189 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory only authentications. */ +@Immutable +public final class AzureADOnlyAuthListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureADOnlyAuthListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..b1b4986c575c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicies.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 BackupShortTermRetentionPolicies. */ +public interface BackupShortTermRetentionPolicies { + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @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 database's short term retention policy. + */ + BackupShortTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName); + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be "default". + * @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 database's short term retention policy. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context); + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's short term retention policy. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's short term retention policy. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's short term retention policy. + * + * @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 database's short term retention policy. + */ + BackupShortTermRetentionPolicy getById(String id); + + /** + * Gets a database's short term retention policy. + * + * @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 database's short term retention policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BackupShortTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new BackupShortTermRetentionPolicy definition. + */ + BackupShortTermRetentionPolicy.DefinitionStages.Blank define(ShortTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..e063d43a8f86f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; + +/** An immutable client-side representation of BackupShortTermRetentionPolicy. */ +public interface BackupShortTermRetentionPolicy { + /** + * 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 retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner object. + * + * @return the inner object. + */ + BackupShortTermRetentionPolicyInner innerModel(); + + /** The entirety of the BackupShortTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The BackupShortTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the BackupShortTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the BackupShortTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the BackupShortTermRetentionPolicy 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.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + BackupShortTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BackupShortTermRetentionPolicy create(Context context); + } + /** The stage of the BackupShortTermRetentionPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the BackupShortTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + BackupShortTermRetentionPolicy.Update update(); + + /** The template for BackupShortTermRetentionPolicy update. */ + interface Update extends UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BackupShortTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BackupShortTermRetentionPolicy apply(Context context); + } + /** The BackupShortTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the BackupShortTermRetentionPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BackupShortTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BackupShortTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..052e58ac2c6bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of short term retention policies. */ +@Immutable +public final class BackupShortTermRetentionPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupShortTermRetentionPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.java new file mode 100644 index 0000000000000..838fb88ad0242 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BackupStorageRedundancy. */ +public final class BackupStorageRedundancy extends ExpandableStringEnum { + /** Static value Geo for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy GEO = fromString("Geo"); + + /** Static value Local for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy LOCAL = fromString("Local"); + + /** Static value Zone for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy ZONE = fromString("Zone"); + + /** + * Creates or finds a BackupStorageRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupStorageRedundancy. + */ + @JsonCreator + public static BackupStorageRedundancy fromString(String name) { + return fromString(name, BackupStorageRedundancy.class); + } + + /** @return known BackupStorageRedundancy values. */ + public static Collection values() { + return values(BackupStorageRedundancy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BlobAuditingPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BlobAuditingPolicyState.java new file mode 100644 index 0000000000000..543e465604ab2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BlobAuditingPolicyState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for BlobAuditingPolicyState. */ +public enum BlobAuditingPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a BlobAuditingPolicyState instance. */ + private final String value; + + BlobAuditingPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BlobAuditingPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed BlobAuditingPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static BlobAuditingPolicyState fromString(String value) { + BlobAuditingPolicyState[] items = BlobAuditingPolicyState.values(); + for (BlobAuditingPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Capabilities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Capabilities.java new file mode 100644 index 0000000000000..736402dd261f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Capabilities.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.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Capabilities. */ +public interface Capabilities { + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @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 subscription capabilities available for the specified location. + */ + LocationCapabilities listByLocation(String locationName); + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. + * @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 subscription capabilities available for the specified location. + */ + Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityGroup.java new file mode 100644 index 0000000000000..30307d0dde550 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityGroup.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CapabilityGroup. */ +public final class CapabilityGroup extends ExpandableStringEnum { + /** Static value supportedEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_EDITIONS = fromString("supportedEditions"); + + /** Static value supportedElasticPoolEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_ELASTIC_POOL_EDITIONS = fromString("supportedElasticPoolEditions"); + + /** Static value supportedManagedInstanceVersions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_MANAGED_INSTANCE_VERSIONS = + fromString("supportedManagedInstanceVersions"); + + /** Static value supportedInstancePoolEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_INSTANCE_POOL_EDITIONS = fromString("supportedInstancePoolEditions"); + + /** Static value supportedManagedInstanceEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_MANAGED_INSTANCE_EDITIONS = + fromString("supportedManagedInstanceEditions"); + + /** + * Creates or finds a CapabilityGroup from its string representation. + * + * @param name a name to look for. + * @return the corresponding CapabilityGroup. + */ + @JsonCreator + public static CapabilityGroup fromString(String name) { + return fromString(name, CapabilityGroup.class); + } + + /** @return known CapabilityGroup values. */ + public static Collection values() { + return values(CapabilityGroup.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityStatus.java new file mode 100644 index 0000000000000..397b2df481d10 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityStatus.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.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CapabilityStatus. */ +public enum CapabilityStatus { + /** Enum value Visible. */ + VISIBLE("Visible"), + + /** Enum value Available. */ + AVAILABLE("Available"), + + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a CapabilityStatus instance. */ + private final String value; + + CapabilityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CapabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed CapabilityStatus object, or null if unable to parse. + */ + @JsonCreator + public static CapabilityStatus fromString(String value) { + CapabilityStatus[] items = CapabilityStatus.values(); + for (CapabilityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CatalogCollationType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CatalogCollationType.java new file mode 100644 index 0000000000000..e9f0987bd8caa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CatalogCollationType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CatalogCollationType. */ +public final class CatalogCollationType extends ExpandableStringEnum { + /** Static value DATABASE_DEFAULT for CatalogCollationType. */ + public static final CatalogCollationType DATABASE_DEFAULT = fromString("DATABASE_DEFAULT"); + + /** Static value SQL_Latin1_General_CP1_CI_AS for CatalogCollationType. */ + public static final CatalogCollationType SQL_LATIN1_GENERAL_CP1_CI_AS = fromString("SQL_Latin1_General_CP1_CI_AS"); + + /** + * Creates or finds a CatalogCollationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CatalogCollationType. + */ + @JsonCreator + public static CatalogCollationType fromString(String name) { + return fromString(name, CatalogCollationType.class); + } + + /** @return known CatalogCollationType values. */ + public static Collection values() { + return values(CatalogCollationType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityReason.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..2108a95112349 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityReason.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CheckNameAvailabilityReason. */ +public enum CheckNameAvailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a CheckNameAvailabilityReason instance. */ + private final String value; + + CheckNameAvailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CheckNameAvailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed CheckNameAvailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String value) { + CheckNameAvailabilityReason[] items = CheckNameAvailabilityReason.values(); + for (CheckNameAvailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..c047c1da35324 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** A request to check whether the specified name for a resource is available. */ +@Fluent +public final class CheckNameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityRequest.class); + + /* + * The name property. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type property. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** Creates an instance of CheckNameAvailabilityRequest class. */ + public CheckNameAvailabilityRequest() { + type = "Microsoft.Sql/servers"; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type property. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model CheckNameAvailabilityRequest")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityResponse.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..5ef4b748bf903 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityResponse.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponse. */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the name property: The name whose availability was checked. + * + * @return the name value. + */ + String name(); + + /** + * Gets the available property: True if the name is available, otherwise false. + * + * @return the available value. + */ + Boolean available(); + + /** + * Gets the reason property: The reason code explaining why the name is unavailable. Will be undefined if the name + * is available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: A message explaining why the name is unavailable. Will be undefined if the name is + * available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.java new file mode 100644 index 0000000000000..8555bbd7585c8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the information necessary to perform a complete database restore operation. */ +@Fluent +public final class CompleteDatabaseRestoreDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CompleteDatabaseRestoreDefinition.class); + + /* + * The last backup name to apply + */ + @JsonProperty(value = "lastBackupName", required = true) + private String lastBackupName; + + /** + * Get the lastBackupName property: The last backup name to apply. + * + * @return the lastBackupName value. + */ + public String lastBackupName() { + return this.lastBackupName; + } + + /** + * Set the lastBackupName property: The last backup name to apply. + * + * @param lastBackupName the lastBackupName value to set. + * @return the CompleteDatabaseRestoreDefinition object itself. + */ + public CompleteDatabaseRestoreDefinition withLastBackupName(String lastBackupName) { + this.lastBackupName = lastBackupName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lastBackupName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property lastBackupName in model CompleteDatabaseRestoreDefinition")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ConnectionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ConnectionPolicyName.java new file mode 100644 index 0000000000000..e8a3d826fd48f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ConnectionPolicyName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConnectionPolicyName. */ +public final class ConnectionPolicyName extends ExpandableStringEnum { + /** Static value default for ConnectionPolicyName. */ + public static final ConnectionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ConnectionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionPolicyName. + */ + @JsonCreator + public static ConnectionPolicyName fromString(String name) { + return fromString(name, ConnectionPolicyName.class); + } + + /** @return known ConnectionPolicyName values. */ + public static Collection values() { + return values(ConnectionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.java new file mode 100644 index 0000000000000..160cb3ab58f38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform long term retention backup copy operation. */ +@JsonFlatten +@Fluent +public class CopyLongTermRetentionBackupParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CopyLongTermRetentionBackupParameters.class); + + /* + * The subscription that owns the target server + */ + @JsonProperty(value = "properties.targetSubscriptionId") + private String targetSubscriptionId; + + /* + * The resource group that owns the target server + */ + @JsonProperty(value = "properties.targetResourceGroup") + private String targetResourceGroup; + + /* + * The resource Id of the target server that owns the database + */ + @JsonProperty(value = "properties.targetServerResourceId") + private String targetServerResourceId; + + /* + * The fully qualified domain name of the target server + */ + @JsonProperty(value = "properties.targetServerFullyQualifiedDomainName") + private String targetServerFullyQualifiedDomainName; + + /* + * The name of the database owns the copied backup. + */ + @JsonProperty(value = "properties.targetDatabaseName") + private String targetDatabaseName; + + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "properties.targetBackupStorageRedundancy") + private TargetBackupStorageRedundancy targetBackupStorageRedundancy; + + /** + * Get the targetSubscriptionId property: The subscription that owns the target server. + * + * @return the targetSubscriptionId value. + */ + public String targetSubscriptionId() { + return this.targetSubscriptionId; + } + + /** + * Set the targetSubscriptionId property: The subscription that owns the target server. + * + * @param targetSubscriptionId the targetSubscriptionId value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetSubscriptionId(String targetSubscriptionId) { + this.targetSubscriptionId = targetSubscriptionId; + return this; + } + + /** + * Get the targetResourceGroup property: The resource group that owns the target server. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the targetResourceGroup property: The resource group that owns the target server. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + + /** + * Get the targetServerResourceId property: The resource Id of the target server that owns the database. + * + * @return the targetServerResourceId value. + */ + public String targetServerResourceId() { + return this.targetServerResourceId; + } + + /** + * Set the targetServerResourceId property: The resource Id of the target server that owns the database. + * + * @param targetServerResourceId the targetServerResourceId value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetServerResourceId(String targetServerResourceId) { + this.targetServerResourceId = targetServerResourceId; + return this; + } + + /** + * Get the targetServerFullyQualifiedDomainName property: The fully qualified domain name of the target server. + * + * @return the targetServerFullyQualifiedDomainName value. + */ + public String targetServerFullyQualifiedDomainName() { + return this.targetServerFullyQualifiedDomainName; + } + + /** + * Set the targetServerFullyQualifiedDomainName property: The fully qualified domain name of the target server. + * + * @param targetServerFullyQualifiedDomainName the targetServerFullyQualifiedDomainName value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetServerFullyQualifiedDomainName( + String targetServerFullyQualifiedDomainName) { + this.targetServerFullyQualifiedDomainName = targetServerFullyQualifiedDomainName; + return this; + } + + /** + * Get the targetDatabaseName property: The name of the database owns the copied backup. + * + * @return the targetDatabaseName value. + */ + public String targetDatabaseName() { + return this.targetDatabaseName; + } + + /** + * Set the targetDatabaseName property: The name of the database owns the copied backup. + * + * @param targetDatabaseName the targetDatabaseName value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetDatabaseName(String targetDatabaseName) { + this.targetDatabaseName = targetDatabaseName; + return this; + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public TargetBackupStorageRedundancy targetBackupStorageRedundancy() { + return this.targetBackupStorageRedundancy; + } + + /** + * Set the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @param targetBackupStorageRedundancy the targetBackupStorageRedundancy value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetBackupStorageRedundancy( + TargetBackupStorageRedundancy targetBackupStorageRedundancy) { + this.targetBackupStorageRedundancy = targetBackupStorageRedundancy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.java new file mode 100644 index 0000000000000..12acba93dfa90 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the information necessary to perform a create database restore point operation. */ +@Fluent +public final class CreateDatabaseRestorePointDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateDatabaseRestorePointDefinition.class); + + /* + * The restore point label to apply + */ + @JsonProperty(value = "restorePointLabel", required = true) + private String restorePointLabel; + + /** + * Get the restorePointLabel property: The restore point label to apply. + * + * @return the restorePointLabel value. + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + + /** + * Set the restorePointLabel property: The restore point label to apply. + * + * @param restorePointLabel the restorePointLabel value to set. + * @return the CreateDatabaseRestorePointDefinition object itself. + */ + public CreateDatabaseRestorePointDefinition withRestorePointLabel(String restorePointLabel) { + this.restorePointLabel = restorePointLabel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restorePointLabel() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restorePointLabel in model CreateDatabaseRestorePointDefinition")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateMode.java new file mode 100644 index 0000000000000..4a98790fddc49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateMode.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreateMode. */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value Copy for CreateMode. */ + public static final CreateMode COPY = fromString("Copy"); + + /** Static value Secondary for CreateMode. */ + public static final CreateMode SECONDARY = fromString("Secondary"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** Static value Recovery for CreateMode. */ + public static final CreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreExternalBackup for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value RestoreExternalBackupSecondary for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP_SECONDARY = fromString("RestoreExternalBackupSecondary"); + + /** Static value RestoreLongTermRetentionBackup for CreateMode. */ + public static final CreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** Static value OnlineSecondary for CreateMode. */ + public static final CreateMode ONLINE_SECONDARY = fromString("OnlineSecondary"); + + /** + * Creates or finds a CreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateMode. + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** @return known CreateMode values. */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CurrentBackupStorageRedundancy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CurrentBackupStorageRedundancy.java new file mode 100644 index 0000000000000..186e561ac78d9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CurrentBackupStorageRedundancy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CurrentBackupStorageRedundancy. */ +public final class CurrentBackupStorageRedundancy extends ExpandableStringEnum { + /** Static value Geo for CurrentBackupStorageRedundancy. */ + public static final CurrentBackupStorageRedundancy GEO = fromString("Geo"); + + /** Static value Local for CurrentBackupStorageRedundancy. */ + public static final CurrentBackupStorageRedundancy LOCAL = fromString("Local"); + + /** Static value Zone for CurrentBackupStorageRedundancy. */ + public static final CurrentBackupStorageRedundancy ZONE = fromString("Zone"); + + /** + * Creates or finds a CurrentBackupStorageRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding CurrentBackupStorageRedundancy. + */ + @JsonCreator + public static CurrentBackupStorageRedundancy fromString(String name) { + return fromString(name, CurrentBackupStorageRedundancy.class); + } + + /** @return known CurrentBackupStorageRedundancy values. */ + public static Collection values() { + return values(CurrentBackupStorageRedundancy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingFunction.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingFunction.java new file mode 100644 index 0000000000000..2590970fcff4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingFunction.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.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DataMaskingFunction. */ +public enum DataMaskingFunction { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value CCN. */ + CCN("CCN"), + + /** Enum value Email. */ + EMAIL("Email"), + + /** Enum value Number. */ + NUMBER("Number"), + + /** Enum value SSN. */ + SSN("SSN"), + + /** Enum value Text. */ + TEXT("Text"); + + /** The actual serialized value for a DataMaskingFunction instance. */ + private final String value; + + DataMaskingFunction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingFunction instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingFunction object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingFunction fromString(String value) { + DataMaskingFunction[] items = DataMaskingFunction.values(); + for (DataMaskingFunction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicies.java new file mode 100644 index 0000000000000..ca4de4e6bc418 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicies.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DataMaskingPolicies. */ +public interface DataMaskingPolicies { + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking policy. + */ + DataMaskingPolicy get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database data masking policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database data masking policy. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database data masking policy. + * + * @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 database data masking policy. + */ + DataMaskingPolicy getById(String id); + + /** + * Gets a database data masking policy. + * + * @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 database data masking policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataMaskingPolicy resource. + * + * @return the first stage of the new DataMaskingPolicy definition. + */ + DataMaskingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicy.java new file mode 100644 index 0000000000000..a3ccecd396f72 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicy.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; + +/** An immutable client-side representation of DataMaskingPolicy. */ +public interface DataMaskingPolicy { + /** + * 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 location of the data masking policy. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: The kind of data masking policy. Metadata, used for Azure portal. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the dataMaskingState property: The state of the data masking policy. + * + * @return the dataMaskingState value. + */ + DataMaskingState dataMaskingState(); + + /** + * Gets the exemptPrincipals property: The list of the exempt principals. Specifies the semicolon-separated list of + * database users for which the data masking policy does not apply. The specified users receive data results without + * masking for all of the database queries. + * + * @return the exemptPrincipals value. + */ + String exemptPrincipals(); + + /** + * Gets the applicationPrincipals property: The list of the application principals. This is a legacy parameter and + * is no longer used. + * + * @return the applicationPrincipals value. + */ + String applicationPrincipals(); + + /** + * Gets the maskingLevel property: The masking level. This is a legacy parameter and is no longer used. + * + * @return the maskingLevel value. + */ + String maskingLevel(); + + /** + * 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.sql.generated.fluent.models.DataMaskingPolicyInner object. + * + * @return the inner object. + */ + DataMaskingPolicyInner innerModel(); + + /** The entirety of the DataMaskingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DataMaskingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the DataMaskingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataMaskingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DataMaskingPolicy 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.WithDataMaskingState, DefinitionStages.WithExemptPrincipals { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataMaskingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataMaskingPolicy create(Context context); + } + /** The stage of the DataMaskingPolicy definition allowing to specify dataMaskingState. */ + interface WithDataMaskingState { + /** + * Specifies the dataMaskingState property: The state of the data masking policy.. + * + * @param dataMaskingState The state of the data masking policy. + * @return the next definition stage. + */ + WithCreate withDataMaskingState(DataMaskingState dataMaskingState); + } + /** The stage of the DataMaskingPolicy definition allowing to specify exemptPrincipals. */ + interface WithExemptPrincipals { + /** + * Specifies the exemptPrincipals property: The list of the exempt principals. Specifies the + * semicolon-separated list of database users for which the data masking policy does not apply. The + * specified users receive data results without masking for all of the database queries.. + * + * @param exemptPrincipals The list of the exempt principals. Specifies the semicolon-separated list of + * database users for which the data masking policy does not apply. The specified users receive data + * results without masking for all of the database queries. + * @return the next definition stage. + */ + WithCreate withExemptPrincipals(String exemptPrincipals); + } + } + /** + * Begins update for the DataMaskingPolicy resource. + * + * @return the stage of resource update. + */ + DataMaskingPolicy.Update update(); + + /** The template for DataMaskingPolicy update. */ + interface Update extends UpdateStages.WithDataMaskingState, UpdateStages.WithExemptPrincipals { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataMaskingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataMaskingPolicy apply(Context context); + } + /** The DataMaskingPolicy update stages. */ + interface UpdateStages { + /** The stage of the DataMaskingPolicy update allowing to specify dataMaskingState. */ + interface WithDataMaskingState { + /** + * Specifies the dataMaskingState property: The state of the data masking policy.. + * + * @param dataMaskingState The state of the data masking policy. + * @return the next definition stage. + */ + Update withDataMaskingState(DataMaskingState dataMaskingState); + } + /** The stage of the DataMaskingPolicy update allowing to specify exemptPrincipals. */ + interface WithExemptPrincipals { + /** + * Specifies the exemptPrincipals property: The list of the exempt principals. Specifies the + * semicolon-separated list of database users for which the data masking policy does not apply. The + * specified users receive data results without masking for all of the database queries.. + * + * @param exemptPrincipals The list of the exempt principals. Specifies the semicolon-separated list of + * database users for which the data masking policy does not apply. The specified users receive data + * results without masking for all of the database queries. + * @return the next definition stage. + */ + Update withExemptPrincipals(String exemptPrincipals); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataMaskingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataMaskingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRule.java new file mode 100644 index 0000000000000..4914d68efc407 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRule.java @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; + +/** An immutable client-side representation of DataMaskingRule. */ +public interface DataMaskingRule { + /** + * 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 location of the data masking rule. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: The kind of Data Masking Rule. Metadata, used for Azure portal. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the idPropertiesId property: The rule Id. + * + * @return the idPropertiesId value. + */ + String idPropertiesId(); + + /** + * Gets the aliasName property: The alias name. This is a legacy parameter and is no longer used. + * + * @return the aliasName value. + */ + String aliasName(); + + /** + * Gets the ruleState property: The rule state. Used to delete a rule. To delete an existing rule, specify the + * schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule + * doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value + * of ruleState. + * + * @return the ruleState value. + */ + DataMaskingRuleState ruleState(); + + /** + * Gets the schemaName property: The schema name on which the data masking rule is applied. + * + * @return the schemaName value. + */ + String schemaName(); + + /** + * Gets the tableName property: The table name on which the data masking rule is applied. + * + * @return the tableName value. + */ + String tableName(); + + /** + * Gets the columnName property: The column name on which the data masking rule is applied. + * + * @return the columnName value. + */ + String columnName(); + + /** + * Gets the maskingFunction property: The masking function that is used for the data masking rule. + * + * @return the maskingFunction value. + */ + DataMaskingFunction maskingFunction(); + + /** + * Gets the numberFrom property: The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * + * @return the numberFrom value. + */ + String numberFrom(); + + /** + * Gets the numberTo property: The numberTo property of the data masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * + * @return the numberTo value. + */ + String numberTo(); + + /** + * Gets the prefixSize property: If maskingFunction is set to Text, the number of characters to show unmasked in the + * beginning of the string. Otherwise, this parameter will be ignored. + * + * @return the prefixSize value. + */ + String prefixSize(); + + /** + * Gets the suffixSize property: If maskingFunction is set to Text, the number of characters to show unmasked at the + * end of the string. Otherwise, this parameter will be ignored. + * + * @return the suffixSize value. + */ + String suffixSize(); + + /** + * Gets the replacementString property: If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + * + * @return the replacementString value. + */ + String replacementString(); + + /** + * 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.sql.generated.fluent.models.DataMaskingRuleInner object. + * + * @return the inner object. + */ + DataMaskingRuleInner innerModel(); + + /** The entirety of the DataMaskingRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DataMaskingRule definition stages. */ + interface DefinitionStages { + /** The first stage of the DataMaskingRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataMaskingRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DataMaskingRule 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.WithAliasName, + DefinitionStages.WithRuleState, + DefinitionStages.WithSchemaName, + DefinitionStages.WithTableName, + DefinitionStages.WithColumnName, + DefinitionStages.WithMaskingFunction, + DefinitionStages.WithNumberFrom, + DefinitionStages.WithNumberTo, + DefinitionStages.WithPrefixSize, + DefinitionStages.WithSuffixSize, + DefinitionStages.WithReplacementString { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataMaskingRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataMaskingRule create(Context context); + } + /** The stage of the DataMaskingRule definition allowing to specify aliasName. */ + interface WithAliasName { + /** + * Specifies the aliasName property: The alias name. This is a legacy parameter and is no longer used.. + * + * @param aliasName The alias name. This is a legacy parameter and is no longer used. + * @return the next definition stage. + */ + WithCreate withAliasName(String aliasName); + } + /** The stage of the DataMaskingRule definition allowing to specify ruleState. */ + interface WithRuleState { + /** + * Specifies the ruleState property: The rule state. Used to delete a rule. To delete an existing rule, + * specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. + * However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, + * regardless of the provided value of ruleState.. + * + * @param ruleState The rule state. Used to delete a rule. To delete an existing rule, specify the + * schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if + * the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of + * the provided value of ruleState. + * @return the next definition stage. + */ + WithCreate withRuleState(DataMaskingRuleState ruleState); + } + /** The stage of the DataMaskingRule definition allowing to specify schemaName. */ + interface WithSchemaName { + /** + * Specifies the schemaName property: The schema name on which the data masking rule is applied.. + * + * @param schemaName The schema name on which the data masking rule is applied. + * @return the next definition stage. + */ + WithCreate withSchemaName(String schemaName); + } + /** The stage of the DataMaskingRule definition allowing to specify tableName. */ + interface WithTableName { + /** + * Specifies the tableName property: The table name on which the data masking rule is applied.. + * + * @param tableName The table name on which the data masking rule is applied. + * @return the next definition stage. + */ + WithCreate withTableName(String tableName); + } + /** The stage of the DataMaskingRule definition allowing to specify columnName. */ + interface WithColumnName { + /** + * Specifies the columnName property: The column name on which the data masking rule is applied.. + * + * @param columnName The column name on which the data masking rule is applied. + * @return the next definition stage. + */ + WithCreate withColumnName(String columnName); + } + /** The stage of the DataMaskingRule definition allowing to specify maskingFunction. */ + interface WithMaskingFunction { + /** + * Specifies the maskingFunction property: The masking function that is used for the data masking rule.. + * + * @param maskingFunction The masking function that is used for the data masking rule. + * @return the next definition stage. + */ + WithCreate withMaskingFunction(DataMaskingFunction maskingFunction); + } + /** The stage of the DataMaskingRule definition allowing to specify numberFrom. */ + interface WithNumberFrom { + /** + * Specifies the numberFrom property: The numberFrom property of the masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be ignored.. + * + * @param numberFrom The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + WithCreate withNumberFrom(String numberFrom); + } + /** The stage of the DataMaskingRule definition allowing to specify numberTo. */ + interface WithNumberTo { + /** + * Specifies the numberTo property: The numberTo property of the data masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be ignored.. + * + * @param numberTo The numberTo property of the data masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + WithCreate withNumberTo(String numberTo); + } + /** The stage of the DataMaskingRule definition allowing to specify prefixSize. */ + interface WithPrefixSize { + /** + * Specifies the prefixSize property: If maskingFunction is set to Text, the number of characters to show + * unmasked in the beginning of the string. Otherwise, this parameter will be ignored.. + * + * @param prefixSize If maskingFunction is set to Text, the number of characters to show unmasked in the + * beginning of the string. Otherwise, this parameter will be ignored. + * @return the next definition stage. + */ + WithCreate withPrefixSize(String prefixSize); + } + /** The stage of the DataMaskingRule definition allowing to specify suffixSize. */ + interface WithSuffixSize { + /** + * Specifies the suffixSize property: If maskingFunction is set to Text, the number of characters to show + * unmasked at the end of the string. Otherwise, this parameter will be ignored.. + * + * @param suffixSize If maskingFunction is set to Text, the number of characters to show unmasked at the end + * of the string. Otherwise, this parameter will be ignored. + * @return the next definition stage. + */ + WithCreate withSuffixSize(String suffixSize); + } + /** The stage of the DataMaskingRule definition allowing to specify replacementString. */ + interface WithReplacementString { + /** + * Specifies the replacementString property: If maskingFunction is set to Text, the character to use for + * masking the unexposed part of the string. Otherwise, this parameter will be ignored.. + * + * @param replacementString If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + * @return the next definition stage. + */ + WithCreate withReplacementString(String replacementString); + } + } + /** + * Begins update for the DataMaskingRule resource. + * + * @return the stage of resource update. + */ + DataMaskingRule.Update update(); + + /** The template for DataMaskingRule update. */ + interface Update + extends UpdateStages.WithAliasName, + UpdateStages.WithRuleState, + UpdateStages.WithSchemaName, + UpdateStages.WithTableName, + UpdateStages.WithColumnName, + UpdateStages.WithMaskingFunction, + UpdateStages.WithNumberFrom, + UpdateStages.WithNumberTo, + UpdateStages.WithPrefixSize, + UpdateStages.WithSuffixSize, + UpdateStages.WithReplacementString { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataMaskingRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataMaskingRule apply(Context context); + } + /** The DataMaskingRule update stages. */ + interface UpdateStages { + /** The stage of the DataMaskingRule update allowing to specify aliasName. */ + interface WithAliasName { + /** + * Specifies the aliasName property: The alias name. This is a legacy parameter and is no longer used.. + * + * @param aliasName The alias name. This is a legacy parameter and is no longer used. + * @return the next definition stage. + */ + Update withAliasName(String aliasName); + } + /** The stage of the DataMaskingRule update allowing to specify ruleState. */ + interface WithRuleState { + /** + * Specifies the ruleState property: The rule state. Used to delete a rule. To delete an existing rule, + * specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. + * However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, + * regardless of the provided value of ruleState.. + * + * @param ruleState The rule state. Used to delete a rule. To delete an existing rule, specify the + * schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if + * the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of + * the provided value of ruleState. + * @return the next definition stage. + */ + Update withRuleState(DataMaskingRuleState ruleState); + } + /** The stage of the DataMaskingRule update allowing to specify schemaName. */ + interface WithSchemaName { + /** + * Specifies the schemaName property: The schema name on which the data masking rule is applied.. + * + * @param schemaName The schema name on which the data masking rule is applied. + * @return the next definition stage. + */ + Update withSchemaName(String schemaName); + } + /** The stage of the DataMaskingRule update allowing to specify tableName. */ + interface WithTableName { + /** + * Specifies the tableName property: The table name on which the data masking rule is applied.. + * + * @param tableName The table name on which the data masking rule is applied. + * @return the next definition stage. + */ + Update withTableName(String tableName); + } + /** The stage of the DataMaskingRule update allowing to specify columnName. */ + interface WithColumnName { + /** + * Specifies the columnName property: The column name on which the data masking rule is applied.. + * + * @param columnName The column name on which the data masking rule is applied. + * @return the next definition stage. + */ + Update withColumnName(String columnName); + } + /** The stage of the DataMaskingRule update allowing to specify maskingFunction. */ + interface WithMaskingFunction { + /** + * Specifies the maskingFunction property: The masking function that is used for the data masking rule.. + * + * @param maskingFunction The masking function that is used for the data masking rule. + * @return the next definition stage. + */ + Update withMaskingFunction(DataMaskingFunction maskingFunction); + } + /** The stage of the DataMaskingRule update allowing to specify numberFrom. */ + interface WithNumberFrom { + /** + * Specifies the numberFrom property: The numberFrom property of the masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be ignored.. + * + * @param numberFrom The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + Update withNumberFrom(String numberFrom); + } + /** The stage of the DataMaskingRule update allowing to specify numberTo. */ + interface WithNumberTo { + /** + * Specifies the numberTo property: The numberTo property of the data masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be ignored.. + * + * @param numberTo The numberTo property of the data masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + Update withNumberTo(String numberTo); + } + /** The stage of the DataMaskingRule update allowing to specify prefixSize. */ + interface WithPrefixSize { + /** + * Specifies the prefixSize property: If maskingFunction is set to Text, the number of characters to show + * unmasked in the beginning of the string. Otherwise, this parameter will be ignored.. + * + * @param prefixSize If maskingFunction is set to Text, the number of characters to show unmasked in the + * beginning of the string. Otherwise, this parameter will be ignored. + * @return the next definition stage. + */ + Update withPrefixSize(String prefixSize); + } + /** The stage of the DataMaskingRule update allowing to specify suffixSize. */ + interface WithSuffixSize { + /** + * Specifies the suffixSize property: If maskingFunction is set to Text, the number of characters to show + * unmasked at the end of the string. Otherwise, this parameter will be ignored.. + * + * @param suffixSize If maskingFunction is set to Text, the number of characters to show unmasked at the end + * of the string. Otherwise, this parameter will be ignored. + * @return the next definition stage. + */ + Update withSuffixSize(String suffixSize); + } + /** The stage of the DataMaskingRule update allowing to specify replacementString. */ + interface WithReplacementString { + /** + * Specifies the replacementString property: If maskingFunction is set to Text, the character to use for + * masking the unexposed part of the string. Otherwise, this parameter will be ignored.. + * + * @param replacementString If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + * @return the next definition stage. + */ + Update withReplacementString(String replacementString); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.java new file mode 100644 index 0000000000000..27264526a0c0b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list data masking rules request. */ +@Fluent +public final class DataMaskingRuleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataMaskingRuleListResult.class); + + /* + * The list of database data masking rules. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of database data masking rules. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of database data masking rules. + * + * @param value the value value to set. + * @return the DataMaskingRuleListResult object itself. + */ + public DataMaskingRuleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleState.java new file mode 100644 index 0000000000000..f663a840baea2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DataMaskingRuleState. */ +public enum DataMaskingRuleState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingRuleState instance. */ + private final String value; + + DataMaskingRuleState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingRuleState instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingRuleState object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingRuleState fromString(String value) { + DataMaskingRuleState[] items = DataMaskingRuleState.values(); + for (DataMaskingRuleState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRules.java new file mode 100644 index 0000000000000..32735205699f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRules.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DataMaskingRules. */ +public interface DataMaskingRules { + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Begins definition for a new DataMaskingRule resource. + * + * @param name resource name. + * @return the first stage of the new DataMaskingRule definition. + */ + DataMaskingRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingState.java new file mode 100644 index 0000000000000..9fff0610c1efc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DataMaskingState. */ +public enum DataMaskingState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingState instance. */ + private final String value; + + DataMaskingState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingState instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingState object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingState fromString(String value) { + DataMaskingState[] items = DataMaskingState.values(); + for (DataMaskingState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java new file mode 100644 index 0000000000000..16655313f4b3d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java @@ -0,0 +1,1188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** An immutable client-side representation of Database. */ +public interface Database { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the kind property: Kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the managedBy property: Resource that manages the database. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the createMode property: Specifies the mode of database creation. + * + *

Default: regular database creation. + * + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource + * ID of the source database. + * + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be + * specified as the resource ID of the existing primary database. + * + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be + * specified. + * + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the + * recoverable database resource ID to restore. + * + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. + * If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. + * Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is + * ignored. restorePointInTime may also be specified to restore from an earlier point in time. + * + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + * + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. + * + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * Gets the collation property: The collation of the database. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * Gets the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * Gets the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + String elasticPoolId(); + + /** + * Gets the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * Gets the status property: The status of the database. + * + * @return the status value. + */ + DatabaseStatus status(); + + /** + * Gets the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * Gets the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + String currentServiceObjectiveName(); + + /** + * Gets the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + String requestedServiceObjectiveName(); + + /** + * Gets the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * Gets the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * Gets the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + OffsetDateTime restorePointInTime(); + + /** + * Gets the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + OffsetDateTime sourceDatabaseDeletionDate(); + + /** + * Gets the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value. + */ + String recoveryServicesRecoveryPointId(); + + /** + * Gets the longTermRetentionBackupResourceId property: The resource identifier of the long term retention backup + * associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * Gets the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * Gets the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * Gets the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * Gets the zoneRedundant property: Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * Gets the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + DatabaseLicenseType licenseType(); + + /** + * Gets the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + Long maxLogSizeBytes(); + + /** + * Gets the earliestRestoreDate property: This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the readScale property: The state of read-only routing. If enabled, connections that have application intent + * set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + * + * @return the readScale value. + */ + DatabaseReadScale readScale(); + + /** + * Gets the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database + * that are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + Integer highAvailabilityReplicaCount(); + + /** + * Gets the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo + * and Named. + * + * @return the secondaryType value. + */ + SecondaryType secondaryType(); + + /** + * Gets the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + Sku currentSku(); + + /** + * Gets the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + Integer autoPauseDelay(); + + /** + * Gets the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + CurrentBackupStorageRedundancy currentBackupStorageRedundancy(); + + /** + * Gets the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + RequestedBackupStorageRedundancy requestedBackupStorageRedundancy(); + + /** + * Gets the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + Double minCapacity(); + + /** + * Gets the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + OffsetDateTime pausedDate(); + + /** + * Gets the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + OffsetDateTime resumedDate(); + + /** + * Gets the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * 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.sql.generated.fluent.models.DatabaseInner object. + * + * @return the inner object. + */ + DatabaseInner innerModel(); + + /** The entirety of the Database definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The Database definition stages. */ + interface DefinitionStages { + /** The first stage of the Database definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Database 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the Database definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the Database 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.WithSku, + DefinitionStages.WithCreateMode, + DefinitionStages.WithCollation, + DefinitionStages.WithMaxSizeBytes, + DefinitionStages.WithSampleName, + DefinitionStages.WithElasticPoolId, + DefinitionStages.WithSourceDatabaseId, + DefinitionStages.WithRestorePointInTime, + DefinitionStages.WithSourceDatabaseDeletionDate, + DefinitionStages.WithRecoveryServicesRecoveryPointId, + DefinitionStages.WithLongTermRetentionBackupResourceId, + DefinitionStages.WithRecoverableDatabaseId, + DefinitionStages.WithRestorableDroppedDatabaseId, + DefinitionStages.WithCatalogCollation, + DefinitionStages.WithZoneRedundant, + DefinitionStages.WithLicenseType, + DefinitionStages.WithReadScale, + DefinitionStages.WithHighAvailabilityReplicaCount, + DefinitionStages.WithSecondaryType, + DefinitionStages.WithAutoPauseDelay, + DefinitionStages.WithRequestedBackupStorageRedundancy, + DefinitionStages.WithMinCapacity, + DefinitionStages.WithMaintenanceConfigurationId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Database create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Database create(Context context); + } + /** The stage of the Database 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 Database definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ```` . + * + * @param sku The database SKU. + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU + * name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, + * use the `Capabilities_ListByLocation` REST API or one of the following commands: + *

```azurecli az sql db list-editions -l <location> -o table ```` + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the Database definition allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: Specifies the mode of database creation. + * + *

Default: regular database creation. + * + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the + * resource ID of the source database. + * + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be + * specified as the resource ID of the existing primary database. + * + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime + * must be specified. + * + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified + * as the recoverable database resource ID to restore. + * + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be + * specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate + * must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and + * sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an + * earlier point in time. + * + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + * + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition.. + * + * @param createMode Specifies the mode of database creation. + *

Default: regular database creation. + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as + * the resource ID of the source database. + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId + * must be specified as the resource ID of the existing primary database. + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing + * database. sourceDatabaseId must be specified as the resource ID of the existing database, and + * restorePointInTime must be specified. + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be + * specified as the recoverable database resource ID to restore. + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be + * specified. If sourceDatabaseId is the database's original resource ID, then + * sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable + * dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also + * be specified to restore from an earlier point in time. + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. + * @return the next definition stage. + */ + WithCreate withCreateMode(CreateMode createMode); + } + /** The stage of the Database definition allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: The collation of the database.. + * + * @param collation The collation of the database. + * @return the next definition stage. + */ + WithCreate withCollation(String collation); + } + /** The stage of the Database definition allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The max size of the database expressed in bytes.. + * + * @param maxSizeBytes The max size of the database expressed in bytes. + * @return the next definition stage. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the Database definition allowing to specify sampleName. */ + interface WithSampleName { + /** + * Specifies the sampleName property: The name of the sample schema to apply when creating this database.. + * + * @param sampleName The name of the sample schema to apply when creating this database. + * @return the next definition stage. + */ + WithCreate withSampleName(SampleName sampleName); + } + /** The stage of the Database definition allowing to specify elasticPoolId. */ + interface WithElasticPoolId { + /** + * Specifies the elasticPoolId property: The resource identifier of the elastic pool containing this + * database.. + * + * @param elasticPoolId The resource identifier of the elastic pool containing this database. + * @return the next definition stage. + */ + WithCreate withElasticPoolId(String elasticPoolId); + } + /** The stage of the Database definition allowing to specify sourceDatabaseId. */ + interface WithSourceDatabaseId { + /** + * Specifies the sourceDatabaseId property: The resource identifier of the source database associated with + * create operation of this database.. + * + * @param sourceDatabaseId The resource identifier of the source database associated with create operation + * of this database. + * @return the next definition stage. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + /** The stage of the Database definition allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database.. + * + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will + * be restored to create the new database. + * @return the next definition stage. + */ + WithCreate withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the Database definition allowing to specify sourceDatabaseDeletionDate. */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted.. + * + * @param sourceDatabaseDeletionDate Specifies the time that the database was deleted. + * @return the next definition stage. + */ + WithCreate withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate); + } + /** The stage of the Database definition allowing to specify recoveryServicesRecoveryPointId. */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point + * associated with create operation of this database.. + * + * @param recoveryServicesRecoveryPointId The resource identifier of the recovery point associated with + * create operation of this database. + * @return the next definition stage. + */ + WithCreate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + /** The stage of the Database definition allowing to specify longTermRetentionBackupResourceId. */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies the longTermRetentionBackupResourceId property: The resource identifier of the long term + * retention backup associated with create operation of this database.. + * + * @param longTermRetentionBackupResourceId The resource identifier of the long term retention backup + * associated with create operation of this database. + * @return the next definition stage. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + /** The stage of the Database definition allowing to specify recoverableDatabaseId. */ + interface WithRecoverableDatabaseId { + /** + * Specifies the recoverableDatabaseId property: The resource identifier of the recoverable database + * associated with create operation of this database.. + * + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create + * operation of this database. + * @return the next definition stage. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + /** The stage of the Database definition allowing to specify restorableDroppedDatabaseId. */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped + * database associated with create operation of this database.. + * + * @param restorableDroppedDatabaseId The resource identifier of the restorable dropped database associated + * with create operation of this database. + * @return the next definition stage. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** The stage of the Database definition allowing to specify catalogCollation. */ + interface WithCatalogCollation { + /** + * Specifies the catalogCollation property: Collation of the metadata catalog.. + * + * @param catalogCollation Collation of the metadata catalog. + * @return the next definition stage. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + /** The stage of the Database definition allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not this database is zone redundant, which means the + * replicas of this database will be spread across multiple availability zones.. + * + * @param zoneRedundant Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * @return the next definition stage. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the Database definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this database. `LicenseIncluded` if you + * need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit.. + * + * @param licenseType The license type to apply for this database. `LicenseIncluded` if you need a license, + * or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * @return the next definition stage. + */ + WithCreate withLicenseType(DatabaseLicenseType licenseType); + } + /** The stage of the Database definition allowing to specify readScale. */ + interface WithReadScale { + /** + * Specifies the readScale property: The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be routed to a readonly secondary + * replica in the same region.. + * + * @param readScale The state of read-only routing. If enabled, connections that have application intent set + * to readonly in their connection string may be routed to a readonly secondary replica in the same + * region. + * @return the next definition stage. + */ + WithCreate withReadScale(DatabaseReadScale readScale); + } + /** The stage of the Database definition allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * database that are used to provide high availability.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the database that + * are used to provide high availability. + * @return the next definition stage. + */ + WithCreate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + /** The stage of the Database definition allowing to specify secondaryType. */ + interface WithSecondaryType { + /** + * Specifies the secondaryType property: The secondary type of the database if it is a secondary. Valid + * values are Geo and Named.. + * + * @param secondaryType The secondary type of the database if it is a secondary. Valid values are Geo and + * Named. + * @return the next definition stage. + */ + WithCreate withSecondaryType(SecondaryType secondaryType); + } + /** The stage of the Database definition allowing to specify autoPauseDelay. */ + interface WithAutoPauseDelay { + /** + * Specifies the autoPauseDelay property: Time in minutes after which database is automatically paused. A + * value of -1 means that automatic pause is disabled. + * + * @param autoPauseDelay Time in minutes after which database is automatically paused. A value of -1 means + * that automatic pause is disabled. + * @return the next definition stage. + */ + WithCreate withAutoPauseDelay(Integer autoPauseDelay); + } + /** The stage of the Database definition allowing to specify requestedBackupStorageRedundancy. */ + interface WithRequestedBackupStorageRedundancy { + /** + * Specifies the requestedBackupStorageRedundancy property: The storage account type to be used to store + * backups for this database.. + * + * @param requestedBackupStorageRedundancy The storage account type to be used to store backups for this + * database. + * @return the next definition stage. + */ + WithCreate withRequestedBackupStorageRedundancy( + RequestedBackupStorageRedundancy requestedBackupStorageRedundancy); + } + /** The stage of the Database definition allowing to specify minCapacity. */ + interface WithMinCapacity { + /** + * Specifies the minCapacity property: Minimal capacity that database will always have allocated, if not + * paused. + * + * @param minCapacity Minimal capacity that database will always have allocated, if not paused. + * @return the next definition stage. + */ + WithCreate withMinCapacity(Double minCapacity); + } + /** The stage of the Database definition allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. + * This configuration defines the period when the maintenance updates will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * @return the next definition stage. + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + } + /** + * Begins update for the Database resource. + * + * @return the stage of resource update. + */ + Database.Update update(); + + /** The template for Database update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithCreateMode, + UpdateStages.WithCollation, + UpdateStages.WithMaxSizeBytes, + UpdateStages.WithSampleName, + UpdateStages.WithElasticPoolId, + UpdateStages.WithSourceDatabaseId, + UpdateStages.WithRestorePointInTime, + UpdateStages.WithSourceDatabaseDeletionDate, + UpdateStages.WithRecoveryServicesRecoveryPointId, + UpdateStages.WithLongTermRetentionBackupResourceId, + UpdateStages.WithRecoverableDatabaseId, + UpdateStages.WithRestorableDroppedDatabaseId, + UpdateStages.WithCatalogCollation, + UpdateStages.WithZoneRedundant, + UpdateStages.WithLicenseType, + UpdateStages.WithReadScale, + UpdateStages.WithHighAvailabilityReplicaCount, + UpdateStages.WithSecondaryType, + UpdateStages.WithAutoPauseDelay, + UpdateStages.WithRequestedBackupStorageRedundancy, + UpdateStages.WithMinCapacity, + UpdateStages.WithMaintenanceConfigurationId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Database apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Database apply(Context context); + } + /** The Database update stages. */ + interface UpdateStages { + /** The stage of the Database update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Database update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and tier of the SKU.. + * + * @param sku The name and tier of the SKU. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the Database update allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: Specifies the mode of database creation. + * + *

Default: regular database creation. + * + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the + * resource ID of the source database. + * + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be + * specified as the resource ID of the existing primary database. + * + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime + * must be specified. + * + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified + * as the recoverable database resource ID to restore. + * + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be + * specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate + * must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and + * sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an + * earlier point in time. + * + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + * + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition.. + * + * @param createMode Specifies the mode of database creation. + *

Default: regular database creation. + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as + * the resource ID of the source database. + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId + * must be specified as the resource ID of the existing primary database. + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing + * database. sourceDatabaseId must be specified as the resource ID of the existing database, and + * restorePointInTime must be specified. + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be + * specified as the recoverable database resource ID to restore. + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be + * specified. If sourceDatabaseId is the database's original resource ID, then + * sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable + * dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also + * be specified to restore from an earlier point in time. + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. + * @return the next definition stage. + */ + Update withCreateMode(CreateMode createMode); + } + /** The stage of the Database update allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: The collation of the database.. + * + * @param collation The collation of the database. + * @return the next definition stage. + */ + Update withCollation(String collation); + } + /** The stage of the Database update allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The max size of the database expressed in bytes.. + * + * @param maxSizeBytes The max size of the database expressed in bytes. + * @return the next definition stage. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the Database update allowing to specify sampleName. */ + interface WithSampleName { + /** + * Specifies the sampleName property: The name of the sample schema to apply when creating this database.. + * + * @param sampleName The name of the sample schema to apply when creating this database. + * @return the next definition stage. + */ + Update withSampleName(SampleName sampleName); + } + /** The stage of the Database update allowing to specify elasticPoolId. */ + interface WithElasticPoolId { + /** + * Specifies the elasticPoolId property: The resource identifier of the elastic pool containing this + * database.. + * + * @param elasticPoolId The resource identifier of the elastic pool containing this database. + * @return the next definition stage. + */ + Update withElasticPoolId(String elasticPoolId); + } + /** The stage of the Database update allowing to specify sourceDatabaseId. */ + interface WithSourceDatabaseId { + /** + * Specifies the sourceDatabaseId property: The resource identifier of the source database associated with + * create operation of this database.. + * + * @param sourceDatabaseId The resource identifier of the source database associated with create operation + * of this database. + * @return the next definition stage. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + /** The stage of the Database update allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database.. + * + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will + * be restored to create the new database. + * @return the next definition stage. + */ + Update withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the Database update allowing to specify sourceDatabaseDeletionDate. */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted.. + * + * @param sourceDatabaseDeletionDate Specifies the time that the database was deleted. + * @return the next definition stage. + */ + Update withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate); + } + /** The stage of the Database update allowing to specify recoveryServicesRecoveryPointId. */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point + * associated with create operation of this database.. + * + * @param recoveryServicesRecoveryPointId The resource identifier of the recovery point associated with + * create operation of this database. + * @return the next definition stage. + */ + Update withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + /** The stage of the Database update allowing to specify longTermRetentionBackupResourceId. */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies the longTermRetentionBackupResourceId property: The resource identifier of the long term + * retention backup associated with create operation of this database.. + * + * @param longTermRetentionBackupResourceId The resource identifier of the long term retention backup + * associated with create operation of this database. + * @return the next definition stage. + */ + Update withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + /** The stage of the Database update allowing to specify recoverableDatabaseId. */ + interface WithRecoverableDatabaseId { + /** + * Specifies the recoverableDatabaseId property: The resource identifier of the recoverable database + * associated with create operation of this database.. + * + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create + * operation of this database. + * @return the next definition stage. + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + /** The stage of the Database update allowing to specify restorableDroppedDatabaseId. */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped + * database associated with create operation of this database.. + * + * @param restorableDroppedDatabaseId The resource identifier of the restorable dropped database associated + * with create operation of this database. + * @return the next definition stage. + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** The stage of the Database update allowing to specify catalogCollation. */ + interface WithCatalogCollation { + /** + * Specifies the catalogCollation property: Collation of the metadata catalog.. + * + * @param catalogCollation Collation of the metadata catalog. + * @return the next definition stage. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + /** The stage of the Database update allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not this database is zone redundant, which means the + * replicas of this database will be spread across multiple availability zones.. + * + * @param zoneRedundant Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * @return the next definition stage. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the Database update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this database. `LicenseIncluded` if you + * need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit.. + * + * @param licenseType The license type to apply for this database. `LicenseIncluded` if you need a license, + * or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * @return the next definition stage. + */ + Update withLicenseType(DatabaseLicenseType licenseType); + } + /** The stage of the Database update allowing to specify readScale. */ + interface WithReadScale { + /** + * Specifies the readScale property: The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be routed to a readonly secondary + * replica in the same region.. + * + * @param readScale The state of read-only routing. If enabled, connections that have application intent set + * to readonly in their connection string may be routed to a readonly secondary replica in the same + * region. + * @return the next definition stage. + */ + Update withReadScale(DatabaseReadScale readScale); + } + /** The stage of the Database update allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * database that are used to provide high availability.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the database that + * are used to provide high availability. + * @return the next definition stage. + */ + Update withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + /** The stage of the Database update allowing to specify secondaryType. */ + interface WithSecondaryType { + /** + * Specifies the secondaryType property: The secondary type of the database if it is a secondary. Valid + * values are Geo and Named.. + * + * @param secondaryType The secondary type of the database if it is a secondary. Valid values are Geo and + * Named. + * @return the next definition stage. + */ + Update withSecondaryType(SecondaryType secondaryType); + } + /** The stage of the Database update allowing to specify autoPauseDelay. */ + interface WithAutoPauseDelay { + /** + * Specifies the autoPauseDelay property: Time in minutes after which database is automatically paused. A + * value of -1 means that automatic pause is disabled. + * + * @param autoPauseDelay Time in minutes after which database is automatically paused. A value of -1 means + * that automatic pause is disabled. + * @return the next definition stage. + */ + Update withAutoPauseDelay(Integer autoPauseDelay); + } + /** The stage of the Database update allowing to specify requestedBackupStorageRedundancy. */ + interface WithRequestedBackupStorageRedundancy { + /** + * Specifies the requestedBackupStorageRedundancy property: The storage account type to be used to store + * backups for this database.. + * + * @param requestedBackupStorageRedundancy The storage account type to be used to store backups for this + * database. + * @return the next definition stage. + */ + Update withRequestedBackupStorageRedundancy( + RequestedBackupStorageRedundancy requestedBackupStorageRedundancy); + } + /** The stage of the Database update allowing to specify minCapacity. */ + interface WithMinCapacity { + /** + * Specifies the minCapacity property: Minimal capacity that database will always have allocated, if not + * paused. + * + * @param minCapacity Minimal capacity that database will always have allocated, if not paused. + * @return the next definition stage. + */ + Update withMinCapacity(Double minCapacity); + } + /** The stage of the Database update allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. + * This configuration defines the period when the maintenance updates will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * @return the next definition stage. + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Database refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Database refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTuning.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTuning.java new file mode 100644 index 0000000000000..ad15607f14c61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTuning.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import java.util.Map; + +/** An immutable client-side representation of DatabaseAutomaticTuning. */ +public interface DatabaseAutomaticTuning { + /** + * 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 desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + AutomaticTuningMode desiredState(); + + /** + * Gets the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + AutomaticTuningMode actualState(); + + /** + * Gets the options property: Automatic tuning options definition. + * + * @return the options value. + */ + Map options(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner object. + * + * @return the inner object. + */ + DatabaseAutomaticTuningInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTunings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTunings.java new file mode 100644 index 0000000000000..d1f5781bc0c63 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTunings.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; + +/** Resource collection API of DatabaseAutomaticTunings. */ +public interface DatabaseAutomaticTunings { + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's automatic tuning. + */ + DatabaseAutomaticTuning get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's automatic tuning. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @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 database-level Automatic Tuning. + */ + DatabaseAutomaticTuning update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters); + + /** + * Update automatic tuning properties for target database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested automatic tuning resource state. + * @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 database-level Automatic Tuning. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..ca0d2668da718 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicies.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 DatabaseBlobAuditingPolicies. */ +public interface DatabaseBlobAuditingPolicies { + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's blob auditing policy. + */ + DatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's blob auditing policy. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's blob auditing policy. + * + * @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 database's blob auditing policy. + */ + DatabaseBlobAuditingPolicy getById(String id); + + /** + * Gets a database's blob auditing policy. + * + * @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 database's blob auditing policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseBlobAuditingPolicy resource. + * + * @return the first stage of the new DatabaseBlobAuditingPolicy definition. + */ + DatabaseBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..0953571d37324 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java @@ -0,0 +1,698 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of DatabaseBlobAuditingPolicy. */ +public interface DatabaseBlobAuditingPolicy { + /** + * 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 kind property: Resource kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner object. + * + * @return the inner object. + */ + DatabaseBlobAuditingPolicyInner innerModel(); + + /** The entirety of the DatabaseBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DatabaseBlobAuditingPolicy 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.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithStorageAccountSubscriptionId, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseBlobAuditingPolicy create(Context context); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Begins update for the DatabaseBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + DatabaseBlobAuditingPolicy.Update update(); + + /** The template for DatabaseBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithStorageAccountSubscriptionId, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseBlobAuditingPolicy apply(Context context); + } + /** The DatabaseBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..016a63cb2fadf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database auditing settings. */ +@Immutable +public final class DatabaseBlobAuditingPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseBlobAuditingPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseLicenseType.java new file mode 100644 index 0000000000000..4f52089663a8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseLicenseType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DatabaseLicenseType. */ +public final class DatabaseLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for DatabaseLicenseType. */ + public static final DatabaseLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for DatabaseLicenseType. */ + public static final DatabaseLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a DatabaseLicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseLicenseType. + */ + @JsonCreator + public static DatabaseLicenseType fromString(String name) { + return fromString(name, DatabaseLicenseType.class); + } + + /** @return known DatabaseLicenseType values. */ + public static Collection values() { + return values(DatabaseLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.java new file mode 100644 index 0000000000000..65daac7c3881d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of databases. */ +@Immutable +public final class DatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperation.java new file mode 100644 index 0000000000000..446d8229da9cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperation.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DatabaseOperation. */ +public interface DatabaseOperation { + /** + * 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 databaseName property: The name of the database the operation is being performed on. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the serverName property: The name of the server. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + ManagementOperationState state(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + OffsetDateTime estimatedCompletionTime(); + + /** + * Gets the description property: The operation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner object. + * + * @return the inner object. + */ + DatabaseOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.java new file mode 100644 index 0000000000000..2a76a3bb9a621 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database operations request. */ +@Immutable +public final class DatabaseOperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseOperationListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperations.java new file mode 100644 index 0000000000000..cdfac3a07b6aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperations.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** Resource collection API of DatabaseOperations. */ +public interface DatabaseOperations { + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId); + + /** + * Cancels the asynchronous operation on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param operationId The operation identifier. + * @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 cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context); + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of operations performed on the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseReadScale.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseReadScale.java new file mode 100644 index 0000000000000..b451b93305184 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseReadScale.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DatabaseReadScale. */ +public final class DatabaseReadScale extends ExpandableStringEnum { + /** Static value Enabled for DatabaseReadScale. */ + public static final DatabaseReadScale ENABLED = fromString("Enabled"); + + /** Static value Disabled for DatabaseReadScale. */ + public static final DatabaseReadScale DISABLED = fromString("Disabled"); + + /** + * Creates or finds a DatabaseReadScale from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseReadScale. + */ + @JsonCreator + public static DatabaseReadScale fromString(String name) { + return fromString(name, DatabaseReadScale.class); + } + + /** @return known DatabaseReadScale values. */ + public static Collection values() { + return values(DatabaseReadScale.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..f9accce9f13c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; + +/** An immutable client-side representation of DatabaseSecurityAlertPolicy. */ +public interface DatabaseSecurityAlertPolicy { + /** + * 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 kind property: Resource kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint and + * storageAccountAccessKey are required. + * + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies the semicolon-separated list of alerts that are disabled, or empty + * string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; + * Data_Exfiltration; Unsafe_Action. + * + * @return the disabledAlerts value. + */ + String disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies the semicolon-separated list of e-mail addresses to which the alert + * is sent. + * + * @return the emailAddresses value. + */ + String emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state + * is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the useServerDefault property: Specifies whether to use the default server policy. + * + * @return the useServerDefault value. + */ + SecurityAlertPolicyUseServerDefault useServerDefault(); + + /** + * 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.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner object. + * + * @return the inner object. + */ + DatabaseSecurityAlertPolicyInner innerModel(); + + /** The entirety of the DatabaseSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DatabaseSecurityAlertPolicy 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.WithLocation, + DefinitionStages.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithUseServerDefault { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseSecurityAlertPolicy create(Context context); + } + /** The stage of the DatabaseSecurityAlertPolicy 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. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint and + * storageAccountAccessKey are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint and + * storageAccountAccessKey are required. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies the semicolon-separated list of alerts that are + * disabled, or empty string to disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action.. + * + * @param disabledAlerts Specifies the semicolon-separated list of alerts that are disabled, or empty string + * to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; + * Data_Exfiltration; Unsafe_Action. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(String disabledAlerts); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies the semicolon-separated list of e-mail addresses to + * which the alert is sent.. + * + * @param emailAddresses Specifies the semicolon-separated list of e-mail addresses to which the alert is + * sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(String emailAddresses); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If + * state is Enabled, storageEndpoint is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. If state is Enabled, storageEndpoint is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account. If state is Enabled, storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify useServerDefault. */ + interface WithUseServerDefault { + /** + * Specifies the useServerDefault property: Specifies whether to use the default server policy.. + * + * @param useServerDefault Specifies whether to use the default server policy. + * @return the next definition stage. + */ + WithCreate withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + } + /** + * Begins update for the DatabaseSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + DatabaseSecurityAlertPolicy.Update update(); + + /** The template for DatabaseSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays, + UpdateStages.WithUseServerDefault { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseSecurityAlertPolicy apply(Context context); + } + /** The DatabaseSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint and + * storageAccountAccessKey are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint and + * storageAccountAccessKey are required. + * @return the next definition stage. + */ + Update withState(SecurityAlertPolicyState state); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies the semicolon-separated list of alerts that are + * disabled, or empty string to disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action.. + * + * @param disabledAlerts Specifies the semicolon-separated list of alerts that are disabled, or empty string + * to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; + * Data_Exfiltration; Unsafe_Action. + * @return the next definition stage. + */ + Update withDisabledAlerts(String disabledAlerts); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies the semicolon-separated list of e-mail addresses to + * which the alert is sent.. + * + * @param emailAddresses Specifies the semicolon-separated list of e-mail addresses to which the alert is + * sent. + * @return the next definition stage. + */ + Update withEmailAddresses(String emailAddresses); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If + * state is Enabled, storageEndpoint is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. If state is Enabled, storageEndpoint is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account. If state is Enabled, storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify useServerDefault. */ + interface WithUseServerDefault { + /** + * Specifies the useServerDefault property: Specifies whether to use the default server policy.. + * + * @param useServerDefault Specifies whether to use the default server policy. + * @return the next definition stage. + */ + Update withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseState.java new file mode 100644 index 0000000000000..b6cd3f403f347 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DatabaseState. */ +public final class DatabaseState extends ExpandableStringEnum { + /** Static value All for DatabaseState. */ + public static final DatabaseState ALL = fromString("All"); + + /** Static value Live for DatabaseState. */ + public static final DatabaseState LIVE = fromString("Live"); + + /** Static value Deleted for DatabaseState. */ + public static final DatabaseState DELETED = fromString("Deleted"); + + /** + * Creates or finds a DatabaseState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseState. + */ + @JsonCreator + public static DatabaseState fromString(String name) { + return fromString(name, DatabaseState.class); + } + + /** @return known DatabaseState values. */ + public static Collection values() { + return values(DatabaseState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.java new file mode 100644 index 0000000000000..4eb722c0e2125 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DatabaseStatus. */ +public final class DatabaseStatus extends ExpandableStringEnum { + /** Static value Online for DatabaseStatus. */ + public static final DatabaseStatus ONLINE = fromString("Online"); + + /** Static value Restoring for DatabaseStatus. */ + public static final DatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value RecoveryPending for DatabaseStatus. */ + public static final DatabaseStatus RECOVERY_PENDING = fromString("RecoveryPending"); + + /** Static value Recovering for DatabaseStatus. */ + public static final DatabaseStatus RECOVERING = fromString("Recovering"); + + /** Static value Suspect for DatabaseStatus. */ + public static final DatabaseStatus SUSPECT = fromString("Suspect"); + + /** Static value Offline for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Standby for DatabaseStatus. */ + public static final DatabaseStatus STANDBY = fromString("Standby"); + + /** Static value Shutdown for DatabaseStatus. */ + public static final DatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value EmergencyMode for DatabaseStatus. */ + public static final DatabaseStatus EMERGENCY_MODE = fromString("EmergencyMode"); + + /** Static value AutoClosed for DatabaseStatus. */ + public static final DatabaseStatus AUTO_CLOSED = fromString("AutoClosed"); + + /** Static value Copying for DatabaseStatus. */ + public static final DatabaseStatus COPYING = fromString("Copying"); + + /** Static value Creating for DatabaseStatus. */ + public static final DatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for DatabaseStatus. */ + public static final DatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value OfflineSecondary for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_SECONDARY = fromString("OfflineSecondary"); + + /** Static value Pausing for DatabaseStatus. */ + public static final DatabaseStatus PAUSING = fromString("Pausing"); + + /** Static value Paused for DatabaseStatus. */ + public static final DatabaseStatus PAUSED = fromString("Paused"); + + /** Static value Resuming for DatabaseStatus. */ + public static final DatabaseStatus RESUMING = fromString("Resuming"); + + /** Static value Scaling for DatabaseStatus. */ + public static final DatabaseStatus SCALING = fromString("Scaling"); + + /** Static value OfflineChangingDwPerformanceTiers for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_CHANGING_DW_PERFORMANCE_TIERS = + fromString("OfflineChangingDwPerformanceTiers"); + + /** Static value OnlineChangingDwPerformanceTiers for DatabaseStatus. */ + public static final DatabaseStatus ONLINE_CHANGING_DW_PERFORMANCE_TIERS = + fromString("OnlineChangingDwPerformanceTiers"); + + /** Static value Disabled for DatabaseStatus. */ + public static final DatabaseStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a DatabaseStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseStatus. + */ + @JsonCreator + public static DatabaseStatus fromString(String name) { + return fromString(name, DatabaseStatus.class); + } + + /** @return known DatabaseStatus values. */ + public static Collection values() { + return values(DatabaseStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseThreatDetectionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseThreatDetectionPolicies.java new file mode 100644 index 0000000000000..051e5dd9ebb53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseThreatDetectionPolicies.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseThreatDetectionPolicies. */ +public interface DatabaseThreatDetectionPolicies { + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 database's threat detection policy. + */ + DatabaseSecurityAlertPolicy get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets a database's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 database's threat detection policy. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * Gets a database's threat detection policy. + * + * @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 database's threat detection policy. + */ + DatabaseSecurityAlertPolicy getById(String id); + + /** + * Gets a database's threat detection policy. + * + * @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 database's threat detection policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseSecurityAlertPolicy definition. + */ + DatabaseSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java new file mode 100644 index 0000000000000..14d6fc58a4a38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java @@ -0,0 +1,990 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** A database resource. */ +@JsonFlatten +@Fluent +public class DatabaseUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseUpdate.class); + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /* + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /* + * The name of the sample schema to apply when creating this database. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /* + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /* + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /* + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /* + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /* + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /* + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private OffsetDateTime sourceDatabaseDeletionDate; + + /* + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /* + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /* + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this database. `LicenseIncluded` if you + * need a license, or `BasePrice` if you have a license and are eligible + * for the Azure Hybrid Benefit. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /* + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /* + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /* + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /* + * The number of secondary replicas associated with the database that are + * used to provide high availability. + */ + @JsonProperty(value = "properties.highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /* + * The secondary type of the database if it is a secondary. Valid values + * are Geo and Named. + */ + @JsonProperty(value = "properties.secondaryType") + private SecondaryType secondaryType; + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /* + * Time in minutes after which database is automatically paused. A value of + * -1 means that automatic pause is disabled + */ + @JsonProperty(value = "properties.autoPauseDelay") + private Integer autoPauseDelay; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "properties.currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private CurrentBackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this database. + */ + @JsonProperty(value = "properties.requestedBackupStorageRedundancy") + private RequestedBackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Minimal capacity that database will always have allocated, if not paused + */ + @JsonProperty(value = "properties.minCapacity") + private Double minCapacity; + + /* + * The date when database was paused by user configuration or + * action(ISO8601 format). Null if the database is ready. + */ + @JsonProperty(value = "properties.pausedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime pausedDate; + + /* + * The date when database was resumed by user action or database login + * (ISO8601 format). Null if the database is paused. + */ + @JsonProperty(value = "properties.resumedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime resumedDate; + + /* + * Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will + * occur. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * Get the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The name and tier of the SKU. + * + * @param sku the sku value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the createMode property: Specifies the mode of database creation. + * + *

Default: regular database creation. + * + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource + * ID of the source database. + * + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be + * specified as the resource ID of the existing primary database. + * + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be + * specified. + * + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the + * recoverable database resource ID to restore. + * + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. + * If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. + * Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is + * ignored. restorePointInTime may also be specified to restore from an earlier point in time. + * + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + * + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Specifies the mode of database creation. + * + *

Default: regular database creation. + * + *

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource + * ID of the source database. + * + *

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be + * specified as the resource ID of the existing primary database. + * + *

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be + * specified. + * + *

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the + * recoverable database resource ID to restore. + * + *

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. + * If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. + * Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is + * ignored. restorePointInTime may also be specified to restore from an earlier point in time. + * + *

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. + * recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + * + *

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. + * + * @param createMode the createMode value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the sampleName property: The name of the sample schema to apply when creating this database. + * + * @param sampleName the sampleName value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value. + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: The resource identifier of the long term retention backup + * associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value. + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the longTermRetentionBackupResourceId property: The resource identifier of the long term retention backup + * associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the zoneRedundant property: Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant property: Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @param licenseType the licenseType value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the readScale property: The state of read-only routing. If enabled, connections that have application intent + * set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the readScale property: The state of read-only routing. If enabled, connections that have application intent + * set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + * + * @param readScale the readScale value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Get the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo and + * Named. + * + * @return the secondaryType value. + */ + public SecondaryType secondaryType() { + return this.secondaryType; + } + + /** + * Set the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo and + * Named. + * + * @param secondaryType the secondaryType value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSecondaryType(SecondaryType secondaryType) { + this.secondaryType = secondaryType; + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * Get the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + public Integer autoPauseDelay() { + return this.autoPauseDelay; + } + + /** + * Set the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @param autoPauseDelay the autoPauseDelay value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withAutoPauseDelay(Integer autoPauseDelay) { + this.autoPauseDelay = autoPauseDelay; + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public CurrentBackupStorageRedundancy currentBackupStorageRedundancy() { + return this.currentBackupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public RequestedBackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRequestedBackupStorageRedundancy( + RequestedBackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Get the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @param minCapacity the minCapacity value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + public OffsetDateTime pausedDate() { + return this.pausedDate; + } + + /** + * Get the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + public OffsetDateTime resumedDate() { + return this.resumedDate; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (currentSku() != null) { + currentSku().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.java new file mode 100644 index 0000000000000..b9584a8b04594 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DatabaseUsage. */ +public interface DatabaseUsage { + /** + * Gets the name property: The name of the usage metric. + * + * @return the name value. + */ + String name(); + + /** + * Gets the resourceName property: The name of the resource. + * + * @return the resourceName value. + */ + String resourceName(); + + /** + * Gets the displayName property: The usage metric display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the currentValue property: The current value of the usage metric. + * + * @return the currentValue value. + */ + Double currentValue(); + + /** + * Gets the limit property: The current limit of the usage metric. + * + * @return the limit value. + */ + Double limit(); + + /** + * Gets the unit property: The units of the usage metric. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the nextResetTime property: The next reset time for the usage metric (ISO8601 format). + * + * @return the nextResetTime value. + */ + OffsetDateTime nextResetTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner object. + * + * @return the inner object. + */ + DatabaseUsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.java new file mode 100644 index 0000000000000..cb6b5afa36981 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database metrics request. */ +@Fluent +public final class DatabaseUsageListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseUsageListResult.class); + + /* + * The list of database usages for the database. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of database usages for the database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of database usages for the database. + * + * @param value the value value to set. + * @return the DatabaseUsageListResult object itself. + */ + public DatabaseUsageListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DatabaseUsageListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsages.java new file mode 100644 index 0000000000000..bfc312fd9f4a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsages.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.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseUsages. */ +public interface DatabaseUsages { + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metrics request. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns database usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metrics request. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessment.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessment.java new file mode 100644 index 0000000000000..0b3480e5da760 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessment.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.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; + +/** An immutable client-side representation of DatabaseVulnerabilityAssessment. */ +public interface DatabaseVulnerabilityAssessment { + /** + * 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 storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy + * doesn't set. + * + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * Gets the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner object. + * + * @return the inner object. + */ + DatabaseVulnerabilityAssessmentInner innerModel(); + + /** The entirety of the DatabaseVulnerabilityAssessment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseVulnerabilityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseVulnerabilityAssessment definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DatabaseVulnerabilityAssessment 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.WithStorageContainerPath, + DefinitionStages.WithStorageContainerSasKey, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRecurringScans { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseVulnerabilityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseVulnerabilityAssessment create(Context context); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability + * assessment policy doesn't set. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability + * assessment policy doesn't set. + * @return the next definition stage. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has read and + * write access to the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the + * blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Begins update for the DatabaseVulnerabilityAssessment resource. + * + * @return the stage of resource update. + */ + DatabaseVulnerabilityAssessment.Update update(); + + /** The template for DatabaseVulnerabilityAssessment update. */ + interface Update + extends UpdateStages.WithStorageContainerPath, + UpdateStages.WithStorageContainerSasKey, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRecurringScans { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseVulnerabilityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseVulnerabilityAssessment apply(Context context); + } + /** The DatabaseVulnerabilityAssessment update stages. */ + interface UpdateStages { + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability + * assessment policy doesn't set. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability + * assessment policy doesn't set. + * @return the next definition stage. + */ + Update withStorageContainerPath(String storageContainerPath); + } + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has read and + * write access to the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the + * blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessment refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.java new file mode 100644 index 0000000000000..be2b28b502deb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the database's vulnerability assessments. */ +@Immutable +public final class DatabaseVulnerabilityAssessmentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaseline.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..e6d9168eee5e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaseline.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseVulnerabilityAssessmentRuleBaseline. */ +public interface DatabaseVulnerabilityAssessmentRuleBaseline { + /** + * 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 baselineResults property: The rule baseline result. + * + * @return the baselineResults value. + */ + List baselineResults(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner object. + * + * @return the inner object. + */ + DatabaseVulnerabilityAssessmentRuleBaselineInner innerModel(); + + /** The entirety of the DatabaseVulnerabilityAssessmentRuleBaseline definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseVulnerabilityAssessmentRuleBaseline definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseVulnerabilityAssessmentRuleBaseline definition. */ + interface Blank extends WithParentResource { + } + /** + * The stage of the DatabaseVulnerabilityAssessmentRuleBaseline definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is + * defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @return the next definition stage. + */ + WithCreate withExistingRule( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId); + } + /** + * The stage of the DatabaseVulnerabilityAssessmentRuleBaseline 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.WithBaselineResults { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline create(Context context); + } + /** + * The stage of the DatabaseVulnerabilityAssessmentRuleBaseline definition allowing to specify baselineResults. + */ + interface WithBaselineResults { + /** + * Specifies the baselineResults property: The rule baseline result. + * + * @param baselineResults The rule baseline result. + * @return the next definition stage. + */ + WithCreate withBaselineResults(List baselineResults); + } + } + /** + * Begins update for the DatabaseVulnerabilityAssessmentRuleBaseline resource. + * + * @return the stage of resource update. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.Update update(); + + /** The template for DatabaseVulnerabilityAssessmentRuleBaseline update. */ + interface Update extends UpdateStages.WithBaselineResults { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline apply(Context context); + } + /** The DatabaseVulnerabilityAssessmentRuleBaseline update stages. */ + interface UpdateStages { + /** The stage of the DatabaseVulnerabilityAssessmentRuleBaseline update allowing to specify baselineResults. */ + interface WithBaselineResults { + /** + * Specifies the baselineResults property: The rule baseline result. + * + * @param baselineResults The rule baseline result. + * @return the next definition stage. + */ + Update withBaselineResults(List baselineResults); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 0000000000000..94b1825f5f7ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties for an Azure SQL Database Vulnerability Assessment rule baseline's result. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentRuleBaselineItem { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselineItem.class); + + /* + * The rule baseline result + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** + * Get the result property: The rule baseline result. + * + * @return the result value. + */ + public List result() { + return this.result; + } + + /** + * Set the result property: The rule baseline result. + * + * @param result the result value to set. + * @return the DatabaseVulnerabilityAssessmentRuleBaselineItem object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem withResult(List result) { + this.result = result; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (result() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property result in model DatabaseVulnerabilityAssessmentRuleBaselineItem")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..caf94a0708bed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselines.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.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseVulnerabilityAssessmentRuleBaselines. */ +public interface DatabaseVulnerabilityAssessmentRuleBaselines { + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @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 database's vulnerability assessment rule baseline. + */ + DatabaseVulnerabilityAssessmentRuleBaseline getById(String id); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @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 database's vulnerability assessment rule baseline. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @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); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @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 DatabaseVulnerabilityAssessmentRuleBaseline resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank define( + VulnerabilityAssessmentPolicyBaselineName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..7e49d576c35fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 DatabaseVulnerabilityAssessmentScans. */ +public interface DatabaseVulnerabilityAssessmentScans { + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScansExport.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScansExport.java new file mode 100644 index 0000000000000..9915c9f27281f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScansExport.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; + +/** An immutable client-side representation of DatabaseVulnerabilityAssessmentScansExport. */ +public interface DatabaseVulnerabilityAssessmentScansExport { + /** + * 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 exportedReportLocation property: Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + * + * @return the exportedReportLocation value. + */ + String exportedReportLocation(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner object. + * + * @return the inner object. + */ + DatabaseVulnerabilityAssessmentScansExportInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..a292c4738821b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessments.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 DatabaseVulnerabilityAssessments. */ +public interface DatabaseVulnerabilityAssessments { + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists the vulnerability assessment policies associated with a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets the database's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment. + */ + DatabaseVulnerabilityAssessment getById(String id); + + /** + * Gets the database's vulnerability assessment. + * + * @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 database's vulnerability assessment. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the database's vulnerability assessment. + * + * @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); + + /** + * Removes the database's vulnerability assessment. + * + * @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 DatabaseVulnerabilityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseVulnerabilityAssessment definition. + */ + DatabaseVulnerabilityAssessment.DefinitionStages.Blank define(VulnerabilityAssessmentName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.java new file mode 100644 index 0000000000000..0128b822f8ea2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.java @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 Databases. */ +public interface Databases { + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String serverName, String databaseName, String filter); + + /** + * Returns database metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName); + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list database metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters); + + /** + * Exports a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context); + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of databases. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of databases. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database. + */ + Database get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName); + + /** + * Deletes the database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + PagedIterable listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + Database pause(String resourceGroupName, String serverName, String databaseName); + + /** + * Pauses a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 database resource. + */ + Database pause(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + Database resume(String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 database resource. + */ + Database resume(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @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 failover(String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @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 failover(String resourceGroupName, String serverName, String databaseName); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of inaccessible databases in a logical server. + */ + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of inaccessible databases in a logical server. + */ + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName, Context context); + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName); + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be upgraded. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @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 rename(String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param parameters The resource move definition for renaming this database. + * @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 renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context); + + /** + * Gets a database. + * + * @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 database. + */ + Database getById(String id); + + /** + * Gets a database. + * + * @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 database. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Database resource. + * + * @param name resource name. + * @return the first stage of the new Database definition. + */ + Database.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.java new file mode 100644 index 0000000000000..4f0e0ec6a92fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The edition capability. */ +@Fluent +public final class EditionCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EditionCapability.class); + + /* + * The database edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The list of supported service objectives for the edition. + */ + @JsonProperty(value = "supportedServiceLevelObjectives", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServiceLevelObjectives; + + /* + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * The read scale capability for the edition. + */ + @JsonProperty(value = "readScale", access = JsonProperty.Access.WRITE_ONLY) + private ReadScaleCapability readScale; + + /* + * The list of supported storage capabilities for this edition + */ + @JsonProperty(value = "supportedStorageCapabilities", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageCapabilities; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The database edition name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedServiceLevelObjectives property: The list of supported service objectives for the edition. + * + * @return the supportedServiceLevelObjectives value. + */ + public List supportedServiceLevelObjectives() { + return this.supportedServiceLevelObjectives; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the readScale property: The read scale capability for the edition. + * + * @return the readScale value. + */ + public ReadScaleCapability readScale() { + return this.readScale; + } + + /** + * Get the supportedStorageCapabilities property: The list of supported storage capabilities for this edition. + * + * @return the supportedStorageCapabilities value. + */ + public List supportedStorageCapabilities() { + return this.supportedStorageCapabilities; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the EditionCapability object itself. + */ + public EditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedServiceLevelObjectives() != null) { + supportedServiceLevelObjectives().forEach(e -> e.validate()); + } + if (readScale() != null) { + readScale().validate(); + } + if (supportedStorageCapabilities() != null) { + supportedStorageCapabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java new file mode 100644 index 0000000000000..d86dde67d7fe6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of ElasticPool. */ +public interface ElasticPool { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the kind property: Kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the state property: The state of the elastic pool. + * + * @return the state value. + */ + ElasticPoolState state(); + + /** + * Gets the creationDate property: The creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * Gets the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + ElasticPoolPerDatabaseSettings perDatabaseSettings(); + + /** + * Gets the zoneRedundant property: Whether or not this elastic pool is zone redundant, which means the replicas of + * this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * Gets the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + ElasticPoolLicenseType licenseType(); + + /** + * Gets the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * 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.sql.generated.fluent.models.ElasticPoolInner object. + * + * @return the inner object. + */ + ElasticPoolInner innerModel(); + + /** The entirety of the ElasticPool definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The ElasticPool definition stages. */ + interface DefinitionStages { + /** The first stage of the ElasticPool definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ElasticPool 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ElasticPool definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ElasticPool 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.WithSku, + DefinitionStages.WithMaxSizeBytes, + DefinitionStages.WithPerDatabaseSettings, + DefinitionStages.WithZoneRedundant, + DefinitionStages.WithLicenseType, + DefinitionStages.WithMaintenanceConfigurationId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ElasticPool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ElasticPool create(Context context); + } + /** The stage of the ElasticPool 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 ElasticPool definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ```` . + * + * @param sku The elastic pool SKU. + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU + * name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, + * use the `Capabilities_ListByLocation` REST API or the following command: + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the ElasticPool definition allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The storage limit for the database elastic pool in bytes.. + * + * @param maxSizeBytes The storage limit for the database elastic pool in bytes. + * @return the next definition stage. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the ElasticPool definition allowing to specify perDatabaseSettings. */ + interface WithPerDatabaseSettings { + /** + * Specifies the perDatabaseSettings property: The per database settings for the elastic pool.. + * + * @param perDatabaseSettings The per database settings for the elastic pool. + * @return the next definition stage. + */ + WithCreate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + /** The stage of the ElasticPool definition allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple availability zones.. + * + * @param zoneRedundant Whether or not this elastic pool is zone redundant, which means the replicas of this + * elastic pool will be spread across multiple availability zones. + * @return the next definition stage. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the ElasticPool definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this elastic pool.. + * + * @param licenseType The license type to apply for this elastic pool. + * @return the next definition stage. + */ + WithCreate withLicenseType(ElasticPoolLicenseType licenseType); + } + /** The stage of the ElasticPool definition allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic + * pool. This configuration defines the period when the maintenance updates will will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * @return the next definition stage. + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + } + /** + * Begins update for the ElasticPool resource. + * + * @return the stage of resource update. + */ + ElasticPool.Update update(); + + /** The template for ElasticPool update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithMaxSizeBytes, + UpdateStages.WithPerDatabaseSettings, + UpdateStages.WithZoneRedundant, + UpdateStages.WithLicenseType, + UpdateStages.WithMaintenanceConfigurationId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ElasticPool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ElasticPool apply(Context context); + } + /** The ElasticPool update stages. */ + interface UpdateStages { + /** The stage of the ElasticPool update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ElasticPool update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: An ARM Resource SKU.. + * + * @param sku An ARM Resource SKU. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the ElasticPool update allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The storage limit for the database elastic pool in bytes.. + * + * @param maxSizeBytes The storage limit for the database elastic pool in bytes. + * @return the next definition stage. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the ElasticPool update allowing to specify perDatabaseSettings. */ + interface WithPerDatabaseSettings { + /** + * Specifies the perDatabaseSettings property: The per database settings for the elastic pool.. + * + * @param perDatabaseSettings The per database settings for the elastic pool. + * @return the next definition stage. + */ + Update withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + /** The stage of the ElasticPool update allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple availability zones.. + * + * @param zoneRedundant Whether or not this elastic pool is zone redundant, which means the replicas of this + * elastic pool will be spread across multiple availability zones. + * @return the next definition stage. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the ElasticPool update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this elastic pool.. + * + * @param licenseType The license type to apply for this elastic pool. + * @return the next definition stage. + */ + Update withLicenseType(ElasticPoolLicenseType licenseType); + } + /** The stage of the ElasticPool update allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic + * pool. This configuration defines the period when the maintenance updates will will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * @return the next definition stage. + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ElasticPool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ElasticPool refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.java new file mode 100644 index 0000000000000..1893d25898d44 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ElasticPoolActivities. */ +public interface ElasticPoolActivities { + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @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 represents the response to a list elastic pool activity request. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool for which to get the current activity. + * @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 represents the response to a list elastic pool activity request. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivity.java new file mode 100644 index 0000000000000..11fc1d4ebeefa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivity.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of ElasticPoolActivity. */ +public interface ElasticPoolActivity { + /** + * 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 endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the operation property: The operation name. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + UUID operationId(); + + /** + * Gets the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the requestedDatabaseDtuMax property: The requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value. + */ + Integer requestedDatabaseDtuMax(); + + /** + * Gets the requestedDatabaseDtuMin property: The requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value. + */ + Integer requestedDatabaseDtuMin(); + + /** + * Gets the requestedDtu property: The requested DTU for the pool if available. + * + * @return the requestedDtu value. + */ + Integer requestedDtu(); + + /** + * Gets the requestedElasticPoolName property: The requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * Gets the requestedStorageLimitInGB property: The requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value. + */ + Long requestedStorageLimitInGB(); + + /** + * Gets the elasticPoolName property: The name of the elastic pool. + * + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * Gets the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The current state of the operation. + * + * @return the state value. + */ + String state(); + + /** + * Gets the requestedStorageLimitInMB property: The requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value. + */ + Integer requestedStorageLimitInMB(); + + /** + * Gets the requestedDatabaseDtuGuarantee property: The requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value. + */ + Integer requestedDatabaseDtuGuarantee(); + + /** + * Gets the requestedDatabaseDtuCap property: The requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value. + */ + Integer requestedDatabaseDtuCap(); + + /** + * Gets the requestedDtuGuarantee property: The requested DTU guarantee. + * + * @return the requestedDtuGuarantee value. + */ + Integer requestedDtuGuarantee(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner object. + * + * @return the inner object. + */ + ElasticPoolActivityInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.java new file mode 100644 index 0000000000000..ad4ad3cc82118 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list elastic pool activity request. */ +@Fluent +public final class ElasticPoolActivityListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolActivityListResult.class); + + /* + * The list of elastic pool activities. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of elastic pool activities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of elastic pool activities. + * + * @param value the value value to set. + * @return the ElasticPoolActivityListResult object itself. + */ + public ElasticPoolActivityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ElasticPoolActivityListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.java new file mode 100644 index 0000000000000..1ee55d14608c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ElasticPoolDatabaseActivities. */ +public interface ElasticPoolDatabaseActivities { + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivity.java new file mode 100644 index 0000000000000..4c18ddbd87db8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivity.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of ElasticPoolDatabaseActivity. */ +public interface ElasticPoolDatabaseActivity { + /** + * 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 databaseName property: The database name. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the operation property: The operation name. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + UUID operationId(); + + /** + * Gets the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the requestedElasticPoolName property: The name for the elastic pool the database is moving into if + * available. + * + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * Gets the currentElasticPoolName property: The name of the current elastic pool the database is in if available. + * + * @return the currentElasticPoolName value. + */ + String currentElasticPoolName(); + + /** + * Gets the currentServiceObjective property: The name of the current service objective if available. + * + * @return the currentServiceObjective value. + */ + String currentServiceObjective(); + + /** + * Gets the requestedServiceObjective property: The name of the requested service objective if available. + * + * @return the requestedServiceObjective value. + */ + String requestedServiceObjective(); + + /** + * Gets the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The current state of the operation. + * + * @return the state value. + */ + String state(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner object. + * + * @return the inner object. + */ + ElasticPoolDatabaseActivityInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.java new file mode 100644 index 0000000000000..755007e43112d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list elastic pool database activity request. */ +@Fluent +public final class ElasticPoolDatabaseActivityListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolDatabaseActivityListResult.class); + + /* + * The list of elastic pool database activities. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of elastic pool database activities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of elastic pool database activities. + * + * @param value the value value to set. + * @return the ElasticPoolDatabaseActivityListResult object itself. + */ + public ElasticPoolDatabaseActivityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ElasticPoolDatabaseActivityListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEdition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEdition.java new file mode 100644 index 0000000000000..6f2bdd68e1965 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEdition.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ElasticPoolEdition. */ +public final class ElasticPoolEdition extends ExpandableStringEnum { + /** Static value Basic for ElasticPoolEdition. */ + public static final ElasticPoolEdition BASIC = fromString("Basic"); + + /** Static value Standard for ElasticPoolEdition. */ + public static final ElasticPoolEdition STANDARD = fromString("Standard"); + + /** Static value Premium for ElasticPoolEdition. */ + public static final ElasticPoolEdition PREMIUM = fromString("Premium"); + + /** Static value GeneralPurpose for ElasticPoolEdition. */ + public static final ElasticPoolEdition GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** Static value BusinessCritical for ElasticPoolEdition. */ + public static final ElasticPoolEdition BUSINESS_CRITICAL = fromString("BusinessCritical"); + + /** + * Creates or finds a ElasticPoolEdition from its string representation. + * + * @param name a name to look for. + * @return the corresponding ElasticPoolEdition. + */ + @JsonCreator + public static ElasticPoolEdition fromString(String name) { + return fromString(name, ElasticPoolEdition.class); + } + + /** @return known ElasticPoolEdition values. */ + public static Collection values() { + return values(ElasticPoolEdition.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.java new file mode 100644 index 0000000000000..ccccedb70830f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The elastic pool edition capability. */ +@Fluent +public final class ElasticPoolEditionCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolEditionCapability.class); + + /* + * The elastic pool edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The list of supported elastic pool DTU levels for the edition. + */ + @JsonProperty(value = "supportedElasticPoolPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolPerformanceLevels; + + /* + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The elastic pool edition name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedElasticPoolPerformanceLevels property: The list of supported elastic pool DTU levels for the + * edition. + * + * @return the supportedElasticPoolPerformanceLevels value. + */ + public List supportedElasticPoolPerformanceLevels() { + return this.supportedElasticPoolPerformanceLevels; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ElasticPoolEditionCapability object itself. + */ + public ElasticPoolEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedElasticPoolPerformanceLevels() != null) { + supportedElasticPoolPerformanceLevels().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolLicenseType.java new file mode 100644 index 0000000000000..be9fca50c7b74 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolLicenseType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ElasticPoolLicenseType. */ +public final class ElasticPoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ElasticPoolLicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ElasticPoolLicenseType. + */ + @JsonCreator + public static ElasticPoolLicenseType fromString(String name) { + return fromString(name, ElasticPoolLicenseType.class); + } + + /** @return known ElasticPoolLicenseType values. */ + public static Collection values() { + return values(ElasticPoolLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.java new file mode 100644 index 0000000000000..d2c166acf084f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of an elastic pool list request. */ +@Immutable +public final class ElasticPoolListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperation.java new file mode 100644 index 0000000000000..5d7553460d20e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperation.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ElasticPoolOperation. */ +public interface ElasticPoolOperation { + /** + * 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 elasticPoolName property: The name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the serverName property: The name of the server. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + String state(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + OffsetDateTime estimatedCompletionTime(); + + /** + * Gets the description property: The operation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner object. + * + * @return the inner object. + */ + ElasticPoolOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.java new file mode 100644 index 0000000000000..a7bf9f8151609 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list elastic pool operations request. */ +@Immutable +public final class ElasticPoolOperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolOperationListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperations.java new file mode 100644 index 0000000000000..54da91d462d42 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperations.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** Resource collection API of ElasticPoolOperations. */ +public interface ElasticPoolOperations { + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId); + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param operationId The operation identifier. + * @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 cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context); + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The elasticPoolName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java new file mode 100644 index 0000000000000..01009208b86e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The max per-database performance level capability. */ +@Fluent +public final class ElasticPoolPerDatabaseMaxPerformanceLevelCapability { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ElasticPoolPerDatabaseMaxPerformanceLevelCapability.class); + + /* + * The maximum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Unit type used to measure performance level. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /* + * The list of supported min database performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMinPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMinPerformanceLevels; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the limit property: The maximum performance level per database. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: Unit type used to measure performance level. + * + * @return the unit value. + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the supportedPerDatabaseMinPerformanceLevels property: The list of supported min database performance levels. + * + * @return the supportedPerDatabaseMinPerformanceLevels value. + */ + public List supportedPerDatabaseMinPerformanceLevels() { + return this.supportedPerDatabaseMinPerformanceLevels; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ElasticPoolPerDatabaseMaxPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMaxPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedPerDatabaseMinPerformanceLevels() != null) { + supportedPerDatabaseMinPerformanceLevels().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java new file mode 100644 index 0000000000000..cc5a2e3fea5f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 minimum per-database performance level capability. */ +@Fluent +public final class ElasticPoolPerDatabaseMinPerformanceLevelCapability { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ElasticPoolPerDatabaseMinPerformanceLevelCapability.class); + + /* + * The minimum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Unit type used to measure performance level. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the limit property: The minimum performance level per database. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: Unit type used to measure performance level. + * + * @return the unit value. + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ElasticPoolPerDatabaseMinPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMinPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.java new file mode 100644 index 0000000000000..9f1470fdd550e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Per database settings of an elastic pool. */ +@Fluent +public final class ElasticPoolPerDatabaseSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolPerDatabaseSettings.class); + + /* + * The minimum capacity all databases are guaranteed. + */ + @JsonProperty(value = "minCapacity") + private Double minCapacity; + + /* + * The maximum capacity any one database can consume. + */ + @JsonProperty(value = "maxCapacity") + private Double maxCapacity; + + /** + * Get the minCapacity property: The minimum capacity all databases are guaranteed. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: The minimum capacity all databases are guaranteed. + * + * @param minCapacity the minCapacity value to set. + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the maxCapacity property: The maximum capacity any one database can consume. + * + * @return the maxCapacity value. + */ + public Double maxCapacity() { + return this.maxCapacity; + } + + /** + * Set the maxCapacity property: The maximum capacity any one database can consume. + * + * @param maxCapacity the maxCapacity value to set. + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMaxCapacity(Double maxCapacity) { + this.maxCapacity = maxCapacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.java new file mode 100644 index 0000000000000..14b93183096c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The Elastic Pool performance level capability. */ +@Fluent +public final class ElasticPoolPerformanceLevelCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolPerformanceLevelCapability.class); + + /* + * The performance level for the pool. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /* + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /* + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /* + * The maximum number of databases supported. + */ + @JsonProperty(value = "maxDatabaseCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxDatabaseCount; + + /* + * The included (free) max size for this performance level. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /* + * The list of supported max sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /* + * The list of supported per database max sizes. + */ + @JsonProperty(value = "supportedPerDatabaseMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxSizes; + + /* + * The list of supported per database max performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMaxPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxPerformanceLevels; + + /* + * Whether or not zone redundancy is supported for the performance level. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * List of supported maintenance configurations + */ + @JsonProperty(value = "supportedMaintenanceConfigurations", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaintenanceConfigurations; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the performanceLevel property: The performance level for the pool. + * + * @return the performanceLevel value. + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku property: The sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the maxDatabaseCount property: The maximum number of databases supported. + * + * @return the maxDatabaseCount value. + */ + public Integer maxDatabaseCount() { + return this.maxDatabaseCount; + } + + /** + * Get the includedMaxSize property: The included (free) max size for this performance level. + * + * @return the includedMaxSize value. + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the supportedMaxSizes property: The list of supported max sizes. + * + * @return the supportedMaxSizes value. + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the supportedPerDatabaseMaxSizes property: The list of supported per database max sizes. + * + * @return the supportedPerDatabaseMaxSizes value. + */ + public List supportedPerDatabaseMaxSizes() { + return this.supportedPerDatabaseMaxSizes; + } + + /** + * Get the supportedPerDatabaseMaxPerformanceLevels property: The list of supported per database max performance + * levels. + * + * @return the supportedPerDatabaseMaxPerformanceLevels value. + */ + public List supportedPerDatabaseMaxPerformanceLevels() { + return this.supportedPerDatabaseMaxPerformanceLevels; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the performance level. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the supportedMaintenanceConfigurations property: List of supported maintenance configurations. + * + * @return the supportedMaintenanceConfigurations value. + */ + public List supportedMaintenanceConfigurations() { + return this.supportedMaintenanceConfigurations; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ElasticPoolPerformanceLevelCapability object itself. + */ + public ElasticPoolPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (performanceLevel() != null) { + performanceLevel().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (includedMaxSize() != null) { + includedMaxSize().validate(); + } + if (supportedMaxSizes() != null) { + supportedMaxSizes().forEach(e -> e.validate()); + } + if (supportedPerDatabaseMaxSizes() != null) { + supportedPerDatabaseMaxSizes().forEach(e -> e.validate()); + } + if (supportedPerDatabaseMaxPerformanceLevels() != null) { + supportedPerDatabaseMaxPerformanceLevels().forEach(e -> e.validate()); + } + if (supportedMaintenanceConfigurations() != null) { + supportedMaintenanceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolState.java new file mode 100644 index 0000000000000..3e3b2a2685a73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ElasticPoolState. */ +public final class ElasticPoolState extends ExpandableStringEnum { + /** Static value Creating for ElasticPoolState. */ + public static final ElasticPoolState CREATING = fromString("Creating"); + + /** Static value Ready for ElasticPoolState. */ + public static final ElasticPoolState READY = fromString("Ready"); + + /** Static value Disabled for ElasticPoolState. */ + public static final ElasticPoolState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ElasticPoolState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ElasticPoolState. + */ + @JsonCreator + public static ElasticPoolState fromString(String name) { + return fromString(name, ElasticPoolState.class); + } + + /** @return known ElasticPoolState values. */ + public static Collection values() { + return values(ElasticPoolState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.java new file mode 100644 index 0000000000000..c305fb5c42c52 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An elastic pool update. */ +@JsonFlatten +@Fluent +public class ElasticPoolUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticPoolUpdate.class); + + /* + * An ARM Resource SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /* + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /* + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this elastic pool. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /* + * Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will + * occur. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * Get the sku property: An ARM Resource SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: An ARM Resource SKU. + * + * @param sku the sku value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get the zoneRedundant property: Whether or not this elastic pool is zone redundant, which means the replicas of + * this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant property: Whether or not this elastic pool is zone redundant, which means the replicas of + * this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this elastic pool. + * + * @param licenseType the licenseType value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (perDatabaseSettings() != null) { + perDatabaseSettings().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.java new file mode 100644 index 0000000000000..aca5f359dbdc3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ElasticPools. */ +public interface ElasticPools { + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter); + + /** + * Returns elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 to a list database metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context); + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all elastic pools in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all elastic pools in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @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 elastic pools in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Integer skip, Context context); + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + ElasticPool get(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @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 failover(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Gets an elastic pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + ElasticPool getById(String id); + + /** + * Gets an elastic pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an elastic pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an elastic pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ElasticPool resource. + * + * @param name resource name. + * @return the first stage of the new ElasticPool definition. + */ + ElasticPool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java new file mode 100644 index 0000000000000..769c42378d5d9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; + +/** An immutable client-side representation of EncryptionProtector. */ +public interface EncryptionProtector { + /** + * 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 kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the subregion property: Subregion of the encryption protector. + * + * @return the subregion value. + */ + String subregion(); + + /** + * Gets the serverKeyName property: The name of the server key. + * + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * Gets the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the server key. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * 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.sql.generated.fluent.models.EncryptionProtectorInner object. + * + * @return the inner object. + */ + EncryptionProtectorInner innerModel(); + + /** The entirety of the EncryptionProtector definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The EncryptionProtector definition stages. */ + interface DefinitionStages { + /** The first stage of the EncryptionProtector definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the EncryptionProtector definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the EncryptionProtector 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.WithServerKeyName, DefinitionStages.WithServerKeyType { + /** + * Executes the create request. + * + * @return the created resource. + */ + EncryptionProtector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EncryptionProtector create(Context context); + } + /** The stage of the EncryptionProtector definition allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the server key.. + * + * @param serverKeyName The name of the server key. + * @return the next definition stage. + */ + WithCreate withServerKeyName(String serverKeyName); + } + /** The stage of the EncryptionProtector definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + } + /** + * Begins update for the EncryptionProtector resource. + * + * @return the stage of resource update. + */ + EncryptionProtector.Update update(); + + /** The template for EncryptionProtector update. */ + interface Update extends UpdateStages.WithServerKeyName, UpdateStages.WithServerKeyType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EncryptionProtector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EncryptionProtector apply(Context context); + } + /** The EncryptionProtector update stages. */ + interface UpdateStages { + /** The stage of the EncryptionProtector update allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the server key.. + * + * @param serverKeyName The name of the server key. + * @return the next definition stage. + */ + Update withServerKeyName(String serverKeyName); + } + /** The stage of the EncryptionProtector update allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + Update withServerKeyType(ServerKeyType serverKeyType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EncryptionProtector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EncryptionProtector refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.java new file mode 100644 index 0000000000000..d3994a97344e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server encryption protectors. */ +@Immutable +public final class EncryptionProtectorListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionProtectorListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorName.java new file mode 100644 index 0000000000000..a50a76b07ef4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EncryptionProtectorName. */ +public final class EncryptionProtectorName extends ExpandableStringEnum { + /** Static value current for EncryptionProtectorName. */ + public static final EncryptionProtectorName CURRENT = fromString("current"); + + /** + * Creates or finds a EncryptionProtectorName from its string representation. + * + * @param name a name to look for. + * @return the corresponding EncryptionProtectorName. + */ + @JsonCreator + public static EncryptionProtectorName fromString(String name) { + return fromString(name, EncryptionProtectorName.class); + } + + /** @return known EncryptionProtectorName values. */ + public static Collection values() { + return values(EncryptionProtectorName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectors.java new file mode 100644 index 0000000000000..7013ce0013288 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectors.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 EncryptionProtectors. */ +public interface EncryptionProtectors { + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + void revalidate(String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server encryption protectors. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server encryption protectors. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 server encryption protector. + */ + EncryptionProtector get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 server encryption protector. + */ + Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * Gets a server encryption protector. + * + * @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 server encryption protector. + */ + EncryptionProtector getById(String id); + + /** + * Gets a server encryption protector. + * + * @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 server encryption protector. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EncryptionProtector resource. + * + * @param name resource name. + * @return the first stage of the new EncryptionProtector definition. + */ + EncryptionProtector.DefinitionStages.Blank define(EncryptionProtectorName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.java new file mode 100644 index 0000000000000..1eb3717c3cf2c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the information necessary to perform export database operation. */ +@Fluent +public final class ExportDatabaseDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportDatabaseDefinition.class); + + /* + * Storage key type. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /* + * Storage key. + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /* + * Storage Uri. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /* + * Administrator login name. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /* + * Administrator login password. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /* + * Authentication type. + */ + @JsonProperty(value = "authenticationType") + private String authenticationType; + + /* + * Optional resource information to enable network isolation for request. + */ + @JsonProperty(value = "networkIsolation") + private NetworkIsolationSettings networkIsolation; + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin property: Administrator login name. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator login name. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: Administrator login password. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: Administrator login password. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType property: Authentication type. + * + * @return the authenticationType value. + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Authentication type. + * + * @param authenticationType the authenticationType value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withAuthenticationType(String authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @return the networkIsolation value. + */ + public NetworkIsolationSettings networkIsolation() { + return this.networkIsolation; + } + + /** + * Set the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @param networkIsolation the networkIsolation value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withNetworkIsolation(NetworkIsolationSettings networkIsolation) { + this.networkIsolation = networkIsolation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageKeyType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model ExportDatabaseDefinition")); + } + if (storageKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model ExportDatabaseDefinition")); + } + if (storageUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model ExportDatabaseDefinition")); + } + if (administratorLogin() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ExportDatabaseDefinition")); + } + if (administratorLoginPassword() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model ExportDatabaseDefinition")); + } + if (networkIsolation() != null) { + networkIsolation().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..e5cf3e298c835 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicies.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ExtendedDatabaseBlobAuditingPolicies. */ +public interface ExtendedDatabaseBlobAuditingPolicies { + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 an extended database's blob auditing policy. + */ + ExtendedDatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets an extended database's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 an extended database's blob auditing policy. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists extended auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets an extended database's blob auditing policy. + * + * @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 an extended database's blob auditing policy. + */ + ExtendedDatabaseBlobAuditingPolicy getById(String id); + + /** + * Gets an extended database's blob auditing policy. + * + * @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 an extended database's blob auditing policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ExtendedDatabaseBlobAuditingPolicy resource. + * + * @return the first stage of the new ExtendedDatabaseBlobAuditingPolicy definition. + */ + ExtendedDatabaseBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..ee89e818292d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java @@ -0,0 +1,738 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ExtendedDatabaseBlobAuditingPolicy. */ +public interface ExtendedDatabaseBlobAuditingPolicy { + /** + * 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 predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * Gets the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner + * object. + * + * @return the inner object. + */ + ExtendedDatabaseBlobAuditingPolicyInner innerModel(); + + /** The entirety of the ExtendedDatabaseBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ExtendedDatabaseBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ExtendedDatabaseBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy 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.WithPredicateExpression, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithStorageAccountSubscriptionId, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs { + /** + * Executes the create request. + * + * @return the created resource. + */ + ExtendedDatabaseBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ExtendedDatabaseBlobAuditingPolicy create(Context context); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify + * storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify + * isStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify + * isAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Begins update for the ExtendedDatabaseBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ExtendedDatabaseBlobAuditingPolicy.Update update(); + + /** The template for ExtendedDatabaseBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithPredicateExpression, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithStorageAccountSubscriptionId, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ExtendedDatabaseBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ExtendedDatabaseBlobAuditingPolicy apply(Context context); + } + /** The ExtendedDatabaseBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + Update withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ExtendedDatabaseBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ExtendedDatabaseBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..dbf4a49cf661e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database extended auditing settings. */ +@Immutable +public final class ExtendedDatabaseBlobAuditingPolicyListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ExtendedDatabaseBlobAuditingPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..611719549164e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicies.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ExtendedServerBlobAuditingPolicies. */ +public interface ExtendedServerBlobAuditingPolicies { + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + ExtendedServerBlobAuditingPolicy get(String resourceGroupName, String serverName); + + /** + * Gets an extended server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 an extended server's blob auditing policy. + */ + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server extended auditing settings. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists extended auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server extended auditing settings. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets an extended server's blob auditing policy. + * + * @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 an extended server's blob auditing policy. + */ + ExtendedServerBlobAuditingPolicy getById(String id); + + /** + * Gets an extended server's blob auditing policy. + * + * @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 an extended server's blob auditing policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ExtendedServerBlobAuditingPolicy resource. + * + * @return the first stage of the new ExtendedServerBlobAuditingPolicy definition. + */ + ExtendedServerBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..f3769c53568da --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java @@ -0,0 +1,729 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ExtendedServerBlobAuditingPolicy. */ +public interface ExtendedServerBlobAuditingPolicy { + /** + * 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 predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * Gets the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner + * object. + * + * @return the inner object. + */ + ExtendedServerBlobAuditingPolicyInner innerModel(); + + /** The entirety of the ExtendedServerBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ExtendedServerBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ExtendedServerBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy 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.WithPredicateExpression, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithStorageAccountSubscriptionId, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs { + /** + * Executes the create request. + * + * @return the created resource. + */ + ExtendedServerBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ExtendedServerBlobAuditingPolicy create(Context context); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify + * storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify isStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify isAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Begins update for the ExtendedServerBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ExtendedServerBlobAuditingPolicy.Update update(); + + /** The template for ExtendedServerBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithPredicateExpression, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithStorageAccountSubscriptionId, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ExtendedServerBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ExtendedServerBlobAuditingPolicy apply(Context context); + } + /** The ExtendedServerBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + Update withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ExtendedServerBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ExtendedServerBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..33eb34643f3d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server extended auditing settings. */ +@Immutable +public final class ExtendedServerBlobAuditingPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedServerBlobAuditingPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java new file mode 100644 index 0000000000000..b504631f38efb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of FailoverGroup. */ +public interface FailoverGroup { + /** + * 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: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + FailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * Gets the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + FailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * Gets the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + FailoverGroupReplicationRole replicationRole(); + + /** + * Gets the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + String replicationState(); + + /** + * Gets the partnerServers property: List of partner server information for the failover group. + * + * @return the partnerServers value. + */ + List partnerServers(); + + /** + * Gets the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + List databases(); + + /** + * 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.sql.generated.fluent.models.FailoverGroupInner object. + * + * @return the inner object. + */ + FailoverGroupInner innerModel(); + + /** The entirety of the FailoverGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The FailoverGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the FailoverGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FailoverGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the FailoverGroup 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.WithReadWriteEndpoint, + DefinitionStages.WithReadOnlyEndpoint, + DefinitionStages.WithPartnerServers, + DefinitionStages.WithDatabases { + /** + * Executes the create request. + * + * @return the created resource. + */ + FailoverGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FailoverGroup create(Context context); + } + /** The stage of the FailoverGroup 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 FailoverGroup definition allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the FailoverGroup definition allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the FailoverGroup definition allowing to specify partnerServers. */ + interface WithPartnerServers { + /** + * Specifies the partnerServers property: List of partner server information for the failover group.. + * + * @param partnerServers List of partner server information for the failover group. + * @return the next definition stage. + */ + WithCreate withPartnerServers(List partnerServers); + } + /** The stage of the FailoverGroup definition allowing to specify databases. */ + interface WithDatabases { + /** + * Specifies the databases property: List of databases in the failover group.. + * + * @param databases List of databases in the failover group. + * @return the next definition stage. + */ + WithCreate withDatabases(List databases); + } + } + /** + * Begins update for the FailoverGroup resource. + * + * @return the stage of resource update. + */ + FailoverGroup.Update update(); + + /** The template for FailoverGroup update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithReadWriteEndpoint, + UpdateStages.WithReadOnlyEndpoint, + UpdateStages.WithDatabases { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FailoverGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FailoverGroup apply(Context context); + } + /** The FailoverGroup update stages. */ + interface UpdateStages { + /** The stage of the FailoverGroup update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the FailoverGroup update allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the FailoverGroup update allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the FailoverGroup update allowing to specify databases. */ + interface WithDatabases { + /** + * Specifies the databases property: List of databases in the failover group.. + * + * @param databases List of databases in the failover group. + * @return the next definition stage. + */ + Update withDatabases(List databases); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FailoverGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FailoverGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.java new file mode 100644 index 0000000000000..6aa5d4be3e8b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of failover groups. */ +@Immutable +public final class FailoverGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverGroupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..f989bfaaf8297 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Read-only endpoint of the failover group instance. */ +@Fluent +public final class FailoverGroupReadOnlyEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverGroupReadOnlyEndpoint.class); + + /* + * Failover policy of the read-only endpoint for the failover group. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @return the failoverPolicy value. + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the FailoverGroupReadOnlyEndpoint object itself. + */ + public FailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..72be786bb4402 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.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.sql.generated.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; + +/** Read-write endpoint of the failover group instance. */ +@Fluent +public final class FailoverGroupReadWriteEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverGroupReadWriteEndpoint.class); + + /* + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /* + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverPolicy value. + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the FailoverGroupReadWriteEndpoint object itself. + */ + public FailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get the failoverWithDataLossGracePeriodMinutes property: Grace period before failover with data loss is attempted + * for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is + * required. + * + * @return the failoverWithDataLossGracePeriodMinutes value. + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set the failoverWithDataLossGracePeriodMinutes property: Grace period before failover with data loss is attempted + * for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is + * required. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set. + * @return the FailoverGroupReadWriteEndpoint object itself. + */ + public FailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes( + Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverPolicy() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failoverPolicy in model FailoverGroupReadWriteEndpoint")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReplicationRole.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..b92edb2e0464e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReplicationRole.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FailoverGroupReplicationRole. */ +public final class FailoverGroupReplicationRole extends ExpandableStringEnum { + /** Static value Primary for FailoverGroupReplicationRole. */ + public static final FailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for FailoverGroupReplicationRole. */ + public static final FailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a FailoverGroupReplicationRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding FailoverGroupReplicationRole. + */ + @JsonCreator + public static FailoverGroupReplicationRole fromString(String name) { + return fromString(name, FailoverGroupReplicationRole.class); + } + + /** @return known FailoverGroupReplicationRole values. */ + public static Collection values() { + return values(FailoverGroupReplicationRole.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupUpdate.java new file mode 100644 index 0000000000000..171e872a5806f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupUpdate.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A failover group update request. */ +@JsonFlatten +@Fluent +public class FailoverGroupUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverGroupUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint") + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * List of databases in the failover group. + */ + @JsonProperty(value = "properties.databases") + private List databases; + + /** + * 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 FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set. + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set. + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.databases; + } + + /** + * Set the databases property: List of databases in the failover group. + * + * @param databases the databases value to set. + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withDatabases(List databases) { + this.databases = databases; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readWriteEndpoint() != null) { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroups.java new file mode 100644 index 0000000000000..f8577aa5603d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroups.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 FailoverGroups. */ +public interface FailoverGroups { + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup get(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists the failover groups in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup failover(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup failover(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup forceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Gets a failover group. + * + * @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 failover group. + */ + FailoverGroup getById(String id); + + /** + * Gets a failover group. + * + * @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 failover group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a failover group. + * + * @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 failover group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FailoverGroup resource. + * + * @param name resource name. + * @return the first stage of the new FailoverGroup definition. + */ + FailoverGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java new file mode 100644 index 0000000000000..b247129a0f24c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; + +/** An immutable client-side representation of FirewallRule. */ +public interface FirewallRule { + /** + * 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 kind property: Kind of server that contains this firewall rule. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Location of the server that contains this firewall rule. + * + * @return the location value. + */ + String location(); + + /** + * Gets the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. Use value + * '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * Gets the endIpAddress property: The end IP address of the firewall rule. Must be IPv4 format. Must be greater + * than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * 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.sql.generated.fluent.models.FirewallRuleInner object. + * + * @return the inner object. + */ + FirewallRuleInner innerModel(); + + /** The entirety of the FirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The FirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the FirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FirewallRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the FirewallRule 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.WithStartIpAddress, DefinitionStages.WithEndIpAddress { + /** + * Executes the create request. + * + * @return the created resource. + */ + FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FirewallRule create(Context context); + } + /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. + * Use value '0.0.0.0' to represent all Azure-internal IP addresses.. + * + * @param startIpAddress The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' + * to represent all Azure-internal IP addresses. + * @return the next definition stage. + */ + WithCreate withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule definition allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: The end IP address of the firewall rule. Must be IPv4 format. Must + * be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP + * addresses.. + * + * @param endIpAddress The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or + * equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * @return the next definition stage. + */ + WithCreate withEndIpAddress(String endIpAddress); + } + } + /** + * Begins update for the FirewallRule resource. + * + * @return the stage of resource update. + */ + FirewallRule.Update update(); + + /** The template for FirewallRule update. */ + interface Update extends UpdateStages.WithStartIpAddress, UpdateStages.WithEndIpAddress { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FirewallRule apply(Context context); + } + /** The FirewallRule update stages. */ + interface UpdateStages { + /** The stage of the FirewallRule update allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. + * Use value '0.0.0.0' to represent all Azure-internal IP addresses.. + * + * @param startIpAddress The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' + * to represent all Azure-internal IP addresses. + * @return the next definition stage. + */ + Update withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule update allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: The end IP address of the firewall rule. Must be IPv4 format. Must + * be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP + * addresses.. + * + * @param endIpAddress The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or + * equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * @return the next definition stage. + */ + Update withEndIpAddress(String endIpAddress); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FirewallRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleListResult.java new file mode 100644 index 0000000000000..bed1523029f93 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a List Firewall Rules request. */ +@Fluent +public final class FirewallRuleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleListResult.class); + + /* + * The list of server firewall rules. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of server firewall rules. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server firewall rules. + * + * @param value the value value to set. + * @return the FirewallRuleListResult object itself. + */ + public FirewallRuleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.java new file mode 100644 index 0000000000000..8e128965dff06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 FirewallRules. */ +public interface FirewallRules { + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 serverName, String firewallRuleName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 serverName, String firewallRuleName, Context context); + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 firewall rule. + */ + FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param firewallRuleName The name of the firewall rule. + * @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 firewall rule. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a List Firewall Rules request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a firewall rule. + * + * @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 firewall rule. + */ + FirewallRule getById(String id); + + /** + * Gets a firewall rule. + * + * @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 firewall rule. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a firewall rule. + * + * @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 firewall rule. + * + * @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 FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new FirewallRule definition. + */ + FirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicies.java new file mode 100644 index 0000000000000..02a08a3327063 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicies.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 GeoBackupPolicies. */ +public interface GeoBackupPolicies { + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @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 geo backup policy. + */ + GeoBackupPolicy get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName); + + /** + * Gets a geo backup policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param geoBackupPolicyName The name of the geo backup policy. + * @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 geo backup policy. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context); + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list geo backup policies request. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns a list of geo backup policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 to a list geo backup policies request. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a geo backup policy. + * + * @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 geo backup policy. + */ + GeoBackupPolicy getById(String id); + + /** + * Gets a geo backup policy. + * + * @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 geo backup policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new GeoBackupPolicy resource. + * + * @param name resource name. + * @return the first stage of the new GeoBackupPolicy definition. + */ + GeoBackupPolicy.DefinitionStages.Blank define(GeoBackupPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicy.java new file mode 100644 index 0000000000000..d50f49e393cdb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicy.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; + +/** An immutable client-side representation of GeoBackupPolicy. */ +public interface GeoBackupPolicy { + /** + * 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 kind property: Kind of geo backup policy. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Backup policy location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the state property: The state of the geo backup policy. + * + * @return the state value. + */ + GeoBackupPolicyState state(); + + /** + * Gets the storageType property: The storage type of the geo backup policy. + * + * @return the storageType value. + */ + String storageType(); + + /** + * 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.sql.generated.fluent.models.GeoBackupPolicyInner object. + * + * @return the inner object. + */ + GeoBackupPolicyInner innerModel(); + + /** The entirety of the GeoBackupPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithState, + DefinitionStages.WithCreate { + } + /** The GeoBackupPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the GeoBackupPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the GeoBackupPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithState withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** The stage of the GeoBackupPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: The state of the geo backup policy.. + * + * @param state The state of the geo backup policy. + * @return the next definition stage. + */ + WithCreate withState(GeoBackupPolicyState state); + } + /** + * The stage of the GeoBackupPolicy 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + GeoBackupPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GeoBackupPolicy create(Context context); + } + } + /** + * Begins update for the GeoBackupPolicy resource. + * + * @return the stage of resource update. + */ + GeoBackupPolicy.Update update(); + + /** The template for GeoBackupPolicy update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GeoBackupPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GeoBackupPolicy apply(Context context); + } + /** The GeoBackupPolicy update stages. */ + interface UpdateStages { + /** The stage of the GeoBackupPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: The state of the geo backup policy.. + * + * @param state The state of the geo backup policy. + * @return the next definition stage. + */ + Update withState(GeoBackupPolicyState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GeoBackupPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GeoBackupPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.java new file mode 100644 index 0000000000000..5e8734e722510 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list geo backup policies request. */ +@Fluent +public final class GeoBackupPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GeoBackupPolicyListResult.class); + + /* + * The list of geo backup policies. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of geo backup policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of geo backup policies. + * + * @param value the value value to set. + * @return the GeoBackupPolicyListResult object itself. + */ + public GeoBackupPolicyListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyName.java new file mode 100644 index 0000000000000..4d47641846197 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GeoBackupPolicyName. */ +public final class GeoBackupPolicyName extends ExpandableStringEnum { + /** Static value Default for GeoBackupPolicyName. */ + public static final GeoBackupPolicyName DEFAULT = fromString("Default"); + + /** + * Creates or finds a GeoBackupPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding GeoBackupPolicyName. + */ + @JsonCreator + public static GeoBackupPolicyName fromString(String name) { + return fromString(name, GeoBackupPolicyName.class); + } + + /** @return known GeoBackupPolicyName values. */ + public static Collection values() { + return values(GeoBackupPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyState.java new file mode 100644 index 0000000000000..cd837744f0a04 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for GeoBackupPolicyState. */ +public enum GeoBackupPolicyState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a GeoBackupPolicyState instance. */ + private final String value; + + GeoBackupPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GeoBackupPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed GeoBackupPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static GeoBackupPolicyState fromString(String value) { + GeoBackupPolicyState[] items = GeoBackupPolicyState.values(); + for (GeoBackupPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.java new file mode 100644 index 0000000000000..5d0f71e65b821 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IdentityType. */ +public final class IdentityType extends ExpandableStringEnum { + /** Static value None for IdentityType. */ + public static final IdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for IdentityType. */ + public static final IdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates or finds a IdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IdentityType. + */ + @JsonCreator + public static IdentityType fromString(String name) { + return fromString(name, IdentityType.class); + } + + /** @return known IdentityType values. */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.java new file mode 100644 index 0000000000000..37501bf5e708c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the information necessary to perform import operation for existing database. */ +@Fluent +public final class ImportExistingDatabaseDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImportExistingDatabaseDefinition.class); + + /* + * Storage key type. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /* + * Storage key. + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /* + * Storage Uri. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /* + * Administrator login name. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /* + * Administrator login password. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /* + * Authentication type. + */ + @JsonProperty(value = "authenticationType") + private String authenticationType; + + /* + * Optional resource information to enable network isolation for request. + */ + @JsonProperty(value = "networkIsolation") + private NetworkIsolationSettings networkIsolation; + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin property: Administrator login name. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator login name. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: Administrator login password. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: Administrator login password. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType property: Authentication type. + * + * @return the authenticationType value. + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Authentication type. + * + * @param authenticationType the authenticationType value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withAuthenticationType(String authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @return the networkIsolation value. + */ + public NetworkIsolationSettings networkIsolation() { + return this.networkIsolation; + } + + /** + * Set the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @param networkIsolation the networkIsolation value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withNetworkIsolation(NetworkIsolationSettings networkIsolation) { + this.networkIsolation = networkIsolation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageKeyType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model ImportExistingDatabaseDefinition")); + } + if (storageKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model ImportExistingDatabaseDefinition")); + } + if (storageUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model ImportExistingDatabaseDefinition")); + } + if (administratorLogin() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ImportExistingDatabaseDefinition")); + } + if (administratorLoginPassword() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model" + + " ImportExistingDatabaseDefinition")); + } + if (networkIsolation() != null) { + networkIsolation().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportOperationResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportOperationResult.java new file mode 100644 index 0000000000000..3418905413bf4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportOperationResult.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ImportExportOperationResult. */ +public interface ImportExportOperationResult { + /** + * 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 requestId property: Request Id. + * + * @return the requestId value. + */ + UUID requestId(); + + /** + * Gets the requestType property: Request type. + * + * @return the requestType value. + */ + String requestType(); + + /** + * Gets the queuedTime property: Queued time. + * + * @return the queuedTime value. + */ + String queuedTime(); + + /** + * Gets the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * Gets the blobUri property: Blob Uri. + * + * @return the blobUri value. + */ + String blobUri(); + + /** + * Gets the serverName property: Server name. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the databaseName property: Database name. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the privateEndpointConnections property: Gets the status of private endpoints associated with this request. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner object. + * + * @return the inner object. + */ + ImportExportOperationResultInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExports.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExports.java new file mode 100644 index 0000000000000..935936ffd6859 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExports.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of ImportExports. */ +public interface ImportExports { + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java new file mode 100644 index 0000000000000..7daee1d7dad11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the information necessary to perform import operation for new database. */ +@Fluent +public final class ImportNewDatabaseDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImportNewDatabaseDefinition.class); + + /* + * Name of the import database. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * Edition of the import database. + */ + @JsonProperty(value = "edition") + private String edition; + + /* + * Service level objective name of the import database. + */ + @JsonProperty(value = "serviceObjectiveName") + private String serviceObjectiveName; + + /* + * Max size in bytes for the import database. + */ + @JsonProperty(value = "maxSizeBytes") + private String maxSizeBytes; + + /* + * Storage key type. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /* + * Storage key. + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /* + * Storage Uri. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /* + * Administrator login name. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /* + * Administrator login password. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /* + * Authentication type. + */ + @JsonProperty(value = "authenticationType") + private String authenticationType; + + /* + * Optional resource information to enable network isolation for request. + */ + @JsonProperty(value = "networkIsolation") + private NetworkIsolationSettings networkIsolation; + + /** + * Get the databaseName property: Name of the import database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: Name of the import database. + * + * @param databaseName the databaseName value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the edition property: Edition of the import database. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Set the edition property: Edition of the import database. + * + * @param edition the edition value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get the serviceObjectiveName property: Service level objective name of the import database. + * + * @return the serviceObjectiveName value. + */ + public String serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Set the serviceObjectiveName property: Service level objective name of the import database. + * + * @param serviceObjectiveName the serviceObjectiveName value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withServiceObjectiveName(String serviceObjectiveName) { + this.serviceObjectiveName = serviceObjectiveName; + return this; + } + + /** + * Get the maxSizeBytes property: Max size in bytes for the import database. + * + * @return the maxSizeBytes value. + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: Max size in bytes for the import database. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin property: Administrator login name. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator login name. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: Administrator login password. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: Administrator login password. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType property: Authentication type. + * + * @return the authenticationType value. + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Authentication type. + * + * @param authenticationType the authenticationType value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withAuthenticationType(String authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @return the networkIsolation value. + */ + public NetworkIsolationSettings networkIsolation() { + return this.networkIsolation; + } + + /** + * Set the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @param networkIsolation the networkIsolation value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withNetworkIsolation(NetworkIsolationSettings networkIsolation) { + this.networkIsolation = networkIsolation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageKeyType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model ImportNewDatabaseDefinition")); + } + if (storageKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model ImportNewDatabaseDefinition")); + } + if (storageUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model ImportNewDatabaseDefinition")); + } + if (administratorLogin() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ImportNewDatabaseDefinition")); + } + if (administratorLoginPassword() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model ImportNewDatabaseDefinition")); + } + if (networkIsolation() != null) { + networkIsolation().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.java new file mode 100644 index 0000000000000..df3ef41102d1b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import java.util.List; + +/** An immutable client-side representation of InstanceFailoverGroup. */ +public interface InstanceFailoverGroup { + /** + * 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 readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * Gets the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * Gets the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + InstanceFailoverGroupReplicationRole replicationRole(); + + /** + * Gets the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + String replicationState(); + + /** + * Gets the partnerRegions property: Partner region information for the failover group. + * + * @return the partnerRegions value. + */ + List partnerRegions(); + + /** + * Gets the managedInstancePairs property: List of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value. + */ + List managedInstancePairs(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner object. + * + * @return the inner object. + */ + InstanceFailoverGroupInner innerModel(); + + /** The entirety of the InstanceFailoverGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The InstanceFailoverGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the InstanceFailoverGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the InstanceFailoverGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, locationName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String resourceGroupName, String locationName); + } + /** + * The stage of the InstanceFailoverGroup 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.WithReadWriteEndpoint, + DefinitionStages.WithReadOnlyEndpoint, + DefinitionStages.WithPartnerRegions, + DefinitionStages.WithManagedInstancePairs { + /** + * Executes the create request. + * + * @return the created resource. + */ + InstanceFailoverGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + InstanceFailoverGroup create(Context context); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify partnerRegions. */ + interface WithPartnerRegions { + /** + * Specifies the partnerRegions property: Partner region information for the failover group.. + * + * @param partnerRegions Partner region information for the failover group. + * @return the next definition stage. + */ + WithCreate withPartnerRegions(List partnerRegions); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify managedInstancePairs. */ + interface WithManagedInstancePairs { + /** + * Specifies the managedInstancePairs property: List of managed instance pairs in the failover group.. + * + * @param managedInstancePairs List of managed instance pairs in the failover group. + * @return the next definition stage. + */ + WithCreate withManagedInstancePairs(List managedInstancePairs); + } + } + /** + * Begins update for the InstanceFailoverGroup resource. + * + * @return the stage of resource update. + */ + InstanceFailoverGroup.Update update(); + + /** The template for InstanceFailoverGroup update. */ + interface Update + extends UpdateStages.WithReadWriteEndpoint, + UpdateStages.WithReadOnlyEndpoint, + UpdateStages.WithPartnerRegions, + UpdateStages.WithManagedInstancePairs { + /** + * Executes the update request. + * + * @return the updated resource. + */ + InstanceFailoverGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + InstanceFailoverGroup apply(Context context); + } + /** The InstanceFailoverGroup update stages. */ + interface UpdateStages { + /** The stage of the InstanceFailoverGroup update allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the InstanceFailoverGroup update allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the InstanceFailoverGroup update allowing to specify partnerRegions. */ + interface WithPartnerRegions { + /** + * Specifies the partnerRegions property: Partner region information for the failover group.. + * + * @param partnerRegions Partner region information for the failover group. + * @return the next definition stage. + */ + Update withPartnerRegions(List partnerRegions); + } + /** The stage of the InstanceFailoverGroup update allowing to specify managedInstancePairs. */ + interface WithManagedInstancePairs { + /** + * Specifies the managedInstancePairs property: List of managed instance pairs in the failover group.. + * + * @param managedInstancePairs List of managed instance pairs in the failover group. + * @return the next definition stage. + */ + Update withManagedInstancePairs(List managedInstancePairs); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + InstanceFailoverGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + InstanceFailoverGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.java new file mode 100644 index 0000000000000..645b1ac24d575 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of instance failover groups. */ +@Immutable +public final class InstanceFailoverGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceFailoverGroupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..7948fbeca5929 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Read-only endpoint of the failover group instance. */ +@Fluent +public final class InstanceFailoverGroupReadOnlyEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceFailoverGroupReadOnlyEndpoint.class); + + /* + * Failover policy of the read-only endpoint for the failover group. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @return the failoverPolicy value. + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the InstanceFailoverGroupReadOnlyEndpoint object itself. + */ + public InstanceFailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..ccf522ab54256 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.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.sql.generated.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; + +/** Read-write endpoint of the failover group instance. */ +@Fluent +public final class InstanceFailoverGroupReadWriteEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceFailoverGroupReadWriteEndpoint.class); + + /* + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /* + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverPolicy value. + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get the failoverWithDataLossGracePeriodMinutes property: Grace period before failover with data loss is attempted + * for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is + * required. + * + * @return the failoverWithDataLossGracePeriodMinutes value. + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set the failoverWithDataLossGracePeriodMinutes property: Grace period before failover with data loss is attempted + * for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is + * required. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set. + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes( + Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverPolicy() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failoverPolicy in model InstanceFailoverGroupReadWriteEndpoint")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReplicationRole.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..59e8a1cde2bc1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReplicationRole.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InstanceFailoverGroupReplicationRole. */ +public final class InstanceFailoverGroupReplicationRole + extends ExpandableStringEnum { + /** Static value Primary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a InstanceFailoverGroupReplicationRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding InstanceFailoverGroupReplicationRole. + */ + @JsonCreator + public static InstanceFailoverGroupReplicationRole fromString(String name) { + return fromString(name, InstanceFailoverGroupReplicationRole.class); + } + + /** @return known InstanceFailoverGroupReplicationRole values. */ + public static Collection values() { + return values(InstanceFailoverGroupReplicationRole.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroups.java new file mode 100644 index 0000000000000..a8dc0475713ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroups.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 InstanceFailoverGroups. */ +public interface InstanceFailoverGroups { + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + InstanceFailoverGroup get(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName, Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup failover(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Gets a failover group. + * + * @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 failover group. + */ + InstanceFailoverGroup getById(String id); + + /** + * Gets a failover group. + * + * @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 failover group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a failover group. + * + * @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 failover group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new InstanceFailoverGroup resource. + * + * @param name resource name. + * @return the first stage of the new InstanceFailoverGroup definition. + */ + InstanceFailoverGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePool.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePool.java new file mode 100644 index 0000000000000..4129071ef49bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePool.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.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import java.util.Map; + +/** An immutable client-side representation of InstancePool. */ +public interface InstancePool { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @return the subnetId value. + */ + String subnetId(); + + /** + * Gets the vCores property: Count of vCores belonging to this instance pool. + * + * @return the vCores value. + */ + Integer vCores(); + + /** + * Gets the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @return the licenseType value. + */ + InstancePoolLicenseType licenseType(); + + /** + * 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.sql.generated.fluent.models.InstancePoolInner object. + * + * @return the inner object. + */ + InstancePoolInner innerModel(); + + /** The entirety of the InstancePool definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The InstancePool definition stages. */ + interface DefinitionStages { + /** The first stage of the InstancePool definition. */ + interface Blank extends WithLocation { + } + /** The stage of the InstancePool definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the InstancePool definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The 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 InstancePool 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.WithSku, + DefinitionStages.WithSubnetId, + DefinitionStages.WithVCores, + DefinitionStages.WithLicenseType { + /** + * Executes the create request. + * + * @return the created resource. + */ + InstancePool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + InstancePool create(Context context); + } + /** The stage of the InstancePool 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 InstancePool definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and tier of the SKU.. + * + * @param sku The name and tier of the SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the InstancePool definition allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: Resource ID of the subnet to place this instance pool in.. + * + * @param subnetId Resource ID of the subnet to place this instance pool in. + * @return the next definition stage. + */ + WithCreate withSubnetId(String subnetId); + } + /** The stage of the InstancePool definition allowing to specify vCores. */ + interface WithVCores { + /** + * Specifies the vCores property: Count of vCores belonging to this instance pool.. + * + * @param vCores Count of vCores belonging to this instance pool. + * @return the next definition stage. + */ + WithCreate withVCores(Integer vCores); + } + /** The stage of the InstancePool definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for + * SQL license is included) and 'BasePrice' (without SQL license price).. + * + * @param licenseType The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * @return the next definition stage. + */ + WithCreate withLicenseType(InstancePoolLicenseType licenseType); + } + } + /** + * Begins update for the InstancePool resource. + * + * @return the stage of resource update. + */ + InstancePool.Update update(); + + /** The template for InstancePool update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + InstancePool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + InstancePool apply(Context context); + } + /** The InstancePool update stages. */ + interface UpdateStages { + /** The stage of the InstancePool 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. + */ + InstancePool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + InstancePool refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.java new file mode 100644 index 0000000000000..1af00724e25fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The instance pool capability. */ +@Fluent +public final class InstancePoolEditionCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstancePoolEditionCapability.class); + + /* + * The instance pool version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The supported families. + */ + @JsonProperty(value = "supportedFamilies", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFamilies; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The instance pool version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedFamilies property: The supported families. + * + * @return the supportedFamilies value. + */ + public List supportedFamilies() { + return this.supportedFamilies; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the InstancePoolEditionCapability object itself. + */ + public InstancePoolEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedFamilies() != null) { + supportedFamilies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.java new file mode 100644 index 0000000000000..ddc1a397584d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The instance pool family capability. */ +@Fluent +public final class InstancePoolFamilyCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstancePoolFamilyCapability.class); + + /* + * Family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /* + * List of supported virtual cores values. + */ + @JsonProperty(value = "supportedVcoresValues", access = JsonProperty.Access.WRITE_ONLY) + private List supportedVcoresValues; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: Family name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the supportedVcoresValues property: List of supported virtual cores values. + * + * @return the supportedVcoresValues value. + */ + public List supportedVcoresValues() { + return this.supportedVcoresValues; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the InstancePoolFamilyCapability object itself. + */ + public InstancePoolFamilyCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (supportedVcoresValues() != null) { + supportedVcoresValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolLicenseType.java new file mode 100644 index 0000000000000..8f836e522ba6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolLicenseType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InstancePoolLicenseType. */ +public final class InstancePoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a InstancePoolLicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding InstancePoolLicenseType. + */ + @JsonCreator + public static InstancePoolLicenseType fromString(String name) { + return fromString(name, InstancePoolLicenseType.class); + } + + /** @return known InstancePoolLicenseType values. */ + public static Collection values() { + return values(InstancePoolLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.java new file mode 100644 index 0000000000000..28a6abeed03b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL instance pools. */ +@Immutable +public final class InstancePoolListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstancePoolListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.java new file mode 100644 index 0000000000000..8ff46c349bc58 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to an Instance pool. */ +@Fluent +public final class InstancePoolUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstancePoolUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the InstancePoolUpdate object itself. + */ + public InstancePoolUpdate 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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.java new file mode 100644 index 0000000000000..2817208a98e4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 managed instance virtual cores capability. */ +@Fluent +public final class InstancePoolVcoresCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstancePoolVcoresCapability.class); + + /* + * The virtual cores identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The virtual cores value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Integer value; + + /* + * Storage limit. + */ + @JsonProperty(value = "storageLimit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability storageLimit; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The virtual cores identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: The virtual cores value. + * + * @return the value value. + */ + public Integer value() { + return this.value; + } + + /** + * Get the storageLimit property: Storage limit. + * + * @return the storageLimit value. + */ + public MaxSizeCapability storageLimit() { + return this.storageLimit; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the InstancePoolVcoresCapability object itself. + */ + public InstancePoolVcoresCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageLimit() != null) { + storageLimit().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePools.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePools.java new file mode 100644 index 0000000000000..99a411de362ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePools.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 InstancePools. */ +public interface InstancePools { + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 an instance pool. + */ + InstancePool getByResourceGroup(String resourceGroupName, String instancePoolName); + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 an instance pool. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @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 instancePoolName); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String instancePoolName, Context context); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The 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 a list of instance pools in the resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription. + */ + PagedIterable list(); + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets an instance pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + InstancePool getById(String id); + + /** + * Gets an instance pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an instance pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an instance pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new InstancePool resource. + * + * @param name resource name. + * @return the first stage of the new InstancePool definition. + */ + InstancePool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Job.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Job.java new file mode 100644 index 0000000000000..859dbcabc58db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Job.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; + +/** An immutable client-side representation of Job. */ +public interface Job { + /** + * 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 description property: User-defined description of the job. + * + * @return the description value. + */ + String description(); + + /** + * Gets the version property: The job version number. + * + * @return the version value. + */ + Integer version(); + + /** + * Gets the schedule property: Schedule properties of the job. + * + * @return the schedule value. + */ + JobSchedule schedule(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobInner object. + * + * @return the inner object. + */ + JobInner innerModel(); + + /** The entirety of the Job definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Job definition stages. */ + interface DefinitionStages { + /** The first stage of the Job definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Job definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @return the next definition stage. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + /** + * The stage of the Job 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.WithDescription, DefinitionStages.WithSchedule { + /** + * Executes the create request. + * + * @return the created resource. + */ + Job create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Job create(Context context); + } + /** The stage of the Job definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User-defined description of the job.. + * + * @param description User-defined description of the job. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Job definition allowing to specify schedule. */ + interface WithSchedule { + /** + * Specifies the schedule property: Schedule properties of the job.. + * + * @param schedule Schedule properties of the job. + * @return the next definition stage. + */ + WithCreate withSchedule(JobSchedule schedule); + } + } + /** + * Begins update for the Job resource. + * + * @return the stage of resource update. + */ + Job.Update update(); + + /** The template for Job update. */ + interface Update extends UpdateStages.WithDescription, UpdateStages.WithSchedule { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Job apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Job apply(Context context); + } + /** The Job update stages. */ + interface UpdateStages { + /** The stage of the Job update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User-defined description of the job.. + * + * @param description User-defined description of the job. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the Job update allowing to specify schedule. */ + interface WithSchedule { + /** + * Specifies the schedule property: Schedule properties of the job.. + * + * @param schedule Schedule properties of the job. + * @return the next definition stage. + */ + Update withSchedule(JobSchedule schedule); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Job refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Job refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgent.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgent.java new file mode 100644 index 0000000000000..f968485da27d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgent.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import java.util.Map; + +/** An immutable client-side representation of JobAgent. */ +public interface JobAgent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the databaseId property: Resource ID of the database to store job metadata in. + * + * @return the databaseId value. + */ + String databaseId(); + + /** + * Gets the state property: The state of the job agent. + * + * @return the state value. + */ + JobAgentState state(); + + /** + * 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.sql.generated.fluent.models.JobAgentInner object. + * + * @return the inner object. + */ + JobAgentInner innerModel(); + + /** The entirety of the JobAgent definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The JobAgent definition stages. */ + interface DefinitionStages { + /** The first stage of the JobAgent definition. */ + interface Blank extends WithLocation { + } + /** The stage of the JobAgent 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the JobAgent definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the JobAgent 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.WithSku, DefinitionStages.WithDatabaseId { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobAgent create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobAgent create(Context context); + } + /** The stage of the JobAgent 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 JobAgent definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and tier of the SKU.. + * + * @param sku The name and tier of the SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the JobAgent definition allowing to specify databaseId. */ + interface WithDatabaseId { + /** + * Specifies the databaseId property: Resource ID of the database to store job metadata in.. + * + * @param databaseId Resource ID of the database to store job metadata in. + * @return the next definition stage. + */ + WithCreate withDatabaseId(String databaseId); + } + } + /** + * Begins update for the JobAgent resource. + * + * @return the stage of resource update. + */ + JobAgent.Update update(); + + /** The template for JobAgent update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobAgent apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobAgent apply(Context context); + } + /** The JobAgent update stages. */ + interface UpdateStages { + /** The stage of the JobAgent 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. + */ + JobAgent refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobAgent refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.java new file mode 100644 index 0000000000000..9aa4e8666712b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL job agents. */ +@Immutable +public final class JobAgentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobAgentListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentState.java new file mode 100644 index 0000000000000..6bdeeea16db46 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobAgentState. */ +public final class JobAgentState extends ExpandableStringEnum { + /** Static value Creating for JobAgentState. */ + public static final JobAgentState CREATING = fromString("Creating"); + + /** Static value Ready for JobAgentState. */ + public static final JobAgentState READY = fromString("Ready"); + + /** Static value Updating for JobAgentState. */ + public static final JobAgentState UPDATING = fromString("Updating"); + + /** Static value Deleting for JobAgentState. */ + public static final JobAgentState DELETING = fromString("Deleting"); + + /** Static value Disabled for JobAgentState. */ + public static final JobAgentState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a JobAgentState from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobAgentState. + */ + @JsonCreator + public static JobAgentState fromString(String name) { + return fromString(name, JobAgentState.class); + } + + /** @return known JobAgentState values. */ + public static Collection values() { + return values(JobAgentState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.java new file mode 100644 index 0000000000000..0168a170ed3bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to an Azure SQL job agent. */ +@Fluent +public final class JobAgentUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobAgentUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the JobAgentUpdate object itself. + */ + public JobAgentUpdate 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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgents.java new file mode 100644 index 0000000000000..7a2e62e64a497 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgents.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 JobAgents. */ +public interface JobAgents { + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of job agents in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of job agents in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 job agent. + */ + JobAgent get(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 job agent. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @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 serverName, String jobAgentName); + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a job agent. + * + * @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 job agent. + */ + JobAgent getById(String id); + + /** + * Gets a job agent. + * + * @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 job agent. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job agent. + * + * @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 job agent. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JobAgent resource. + * + * @param name resource name. + * @return the first stage of the new JobAgent definition. + */ + JobAgent.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredential.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredential.java new file mode 100644 index 0000000000000..b8ab8aae9b47c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredential.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; + +/** An immutable client-side representation of JobCredential. */ +public interface JobCredential { + /** + * 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 username property: The credential user name. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: The credential password. + * + * @return the password value. + */ + String password(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner object. + * + * @return the inner object. + */ + JobCredentialInner innerModel(); + + /** The entirety of the JobCredential definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobCredential definition stages. */ + interface DefinitionStages { + /** The first stage of the JobCredential definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobCredential definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @return the next definition stage. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + /** + * The stage of the JobCredential 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.WithUsername, DefinitionStages.WithPassword { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobCredential create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobCredential create(Context context); + } + /** The stage of the JobCredential definition allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: The credential user name.. + * + * @param username The credential user name. + * @return the next definition stage. + */ + WithCreate withUsername(String username); + } + /** The stage of the JobCredential definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: The credential password.. + * + * @param password The credential password. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + } + /** + * Begins update for the JobCredential resource. + * + * @return the stage of resource update. + */ + JobCredential.Update update(); + + /** The template for JobCredential update. */ + interface Update extends UpdateStages.WithUsername, UpdateStages.WithPassword { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobCredential apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobCredential apply(Context context); + } + /** The JobCredential update stages. */ + interface UpdateStages { + /** The stage of the JobCredential update allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: The credential user name.. + * + * @param username The credential user name. + * @return the next definition stage. + */ + Update withUsername(String username); + } + /** The stage of the JobCredential update allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: The credential password.. + * + * @param password The credential password. + * @return the next definition stage. + */ + Update withPassword(String password); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobCredential refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobCredential refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.java new file mode 100644 index 0000000000000..93eade8894539 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job credentials. */ +@Immutable +public final class JobCredentialListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCredentialListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentials.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentials.java new file mode 100644 index 0000000000000..6a49898b880bc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentials.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.sql.generated.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 JobCredentials. */ +public interface JobCredentials { + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials. + */ + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobs credential. + */ + JobCredential get(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobs credential. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context); + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName); + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName, Context context); + + /** + * Gets a jobs credential. + * + * @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 jobs credential. + */ + JobCredential getById(String id); + + /** + * Gets a jobs credential. + * + * @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 jobs credential. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job credential. + * + * @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 job credential. + * + * @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 JobCredential resource. + * + * @param name resource name. + * @return the first stage of the new JobCredential definition. + */ + JobCredential.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecution.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecution.java new file mode 100644 index 0000000000000..6723a98eae36a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecution.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of JobExecution. */ +public interface JobExecution { + /** + * 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 jobVersion property: The job version number. + * + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * Gets the stepName property: The job step name. + * + * @return the stepName value. + */ + String stepName(); + + /** + * Gets the stepId property: The job step id. + * + * @return the stepId value. + */ + Integer stepId(); + + /** + * Gets the jobExecutionId property: The unique identifier of the job execution. + * + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * Gets the lifecycle property: The detailed state of the job execution. + * + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * Gets the provisioningState property: The ARM provisioning state of the job execution. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the createTime property: The time that the job execution was created. + * + * @return the createTime value. + */ + OffsetDateTime createTime(); + + /** + * Gets the startTime property: The time that the job execution started. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The time that the job execution completed. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the currentAttempts property: Number of times the job execution has been attempted. + * + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * Gets the currentAttemptStartTime property: Start time of the current attempt. + * + * @return the currentAttemptStartTime value. + */ + OffsetDateTime currentAttemptStartTime(); + + /** + * Gets the lastMessage property: The last status or error message. + * + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * Gets the target property: The target that this execution is executed on. + * + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner object. + * + * @return the inner object. + */ + JobExecutionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionLifecycle.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionLifecycle.java new file mode 100644 index 0000000000000..d4dd65cc297ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionLifecycle.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobExecutionLifecycle. */ +public final class JobExecutionLifecycle extends ExpandableStringEnum { + /** Static value Created for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CREATED = fromString("Created"); + + /** Static value InProgress for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle IN_PROGRESS = fromString("InProgress"); + + /** Static value WaitingForChildJobExecutions for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_CHILD_JOB_EXECUTIONS = + fromString("WaitingForChildJobExecutions"); + + /** Static value WaitingForRetry for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_RETRY = fromString("WaitingForRetry"); + + /** Static value Succeeded for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED = fromString("Succeeded"); + + /** Static value SucceededWithSkipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED_WITH_SKIPPED = fromString("SucceededWithSkipped"); + + /** Static value Failed for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle FAILED = fromString("Failed"); + + /** Static value TimedOut for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle TIMED_OUT = fromString("TimedOut"); + + /** Static value Canceled for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CANCELED = fromString("Canceled"); + + /** Static value Skipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SKIPPED = fromString("Skipped"); + + /** + * Creates or finds a JobExecutionLifecycle from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobExecutionLifecycle. + */ + @JsonCreator + public static JobExecutionLifecycle fromString(String name) { + return fromString(name, JobExecutionLifecycle.class); + } + + /** @return known JobExecutionLifecycle values. */ + public static Collection values() { + return values(JobExecutionLifecycle.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.java new file mode 100644 index 0000000000000..ffeaa4f5f744c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job executions. */ +@Immutable +public final class JobExecutionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobExecutionListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.java new file mode 100644 index 0000000000000..b5098dfb21a8a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The target that a job execution is executed on. */ +@Immutable +public final class JobExecutionTarget { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobExecutionTarget.class); + + /* + * The type of the target. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private JobTargetType type; + + /* + * The server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * Get the type property: The type of the target. + * + * @return the type value. + */ + public JobTargetType type() { + return this.type; + } + + /** + * Get the serverName property: The server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName property: The database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutions.java new file mode 100644 index 0000000000000..e21d1ed9d162d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutions.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Resource collection API of JobExecutions. */ +public interface JobExecutions { + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancel(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + JobExecution create(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 an execution of a job. + */ + JobExecution create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @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 job execution. + */ + JobExecution get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution. + * @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 job execution. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + JobExecution createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Creates or updates a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 an execution of a job. + */ + JobExecution createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.java new file mode 100644 index 0000000000000..4d09ae6f1aaa8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of jobs. */ +@Immutable +public final class JobListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.java new file mode 100644 index 0000000000000..b7cf21d56f994 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Scheduling properties of a job. */ +@Fluent +public final class JobSchedule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobSchedule.class); + + /* + * Schedule start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Schedule end time. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * Schedule interval type + */ + @JsonProperty(value = "type") + private JobScheduleType type; + + /* + * Whether or not the schedule is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * Value of the schedule's recurring interval, if the schedule type is + * recurring. ISO8601 duration format. + */ + @JsonProperty(value = "interval") + private String interval; + + /** + * Get the startTime property: Schedule start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Schedule start time. + * + * @param startTime the startTime value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Schedule end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Schedule end time. + * + * @param endTime the endTime value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the type property: Schedule interval type. + * + * @return the type value. + */ + public JobScheduleType type() { + return this.type; + } + + /** + * Set the type property: Schedule interval type. + * + * @param type the type value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withType(JobScheduleType type) { + this.type = type; + return this; + } + + /** + * Get the enabled property: Whether or not the schedule is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Whether or not the schedule is enabled. + * + * @param enabled the enabled value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the interval property: Value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 + * duration format. + * + * @return the interval value. + */ + public String interval() { + return this.interval; + } + + /** + * Set the interval property: Value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 + * duration format. + * + * @param interval the interval value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withInterval(String interval) { + this.interval = interval; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobScheduleType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobScheduleType.java new file mode 100644 index 0000000000000..04fa36caa181e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobScheduleType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobScheduleType. */ +public enum JobScheduleType { + /** Enum value Once. */ + ONCE("Once"), + + /** Enum value Recurring. */ + RECURRING("Recurring"); + + /** The actual serialized value for a JobScheduleType instance. */ + private final String value; + + JobScheduleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobScheduleType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobScheduleType object, or null if unable to parse. + */ + @JsonCreator + public static JobScheduleType fromString(String value) { + JobScheduleType[] items = JobScheduleType.values(); + for (JobScheduleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStep.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStep.java new file mode 100644 index 0000000000000..2921ae115a258 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStep.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; + +/** An immutable client-side representation of JobStep. */ +public interface JobStep { + /** + * 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 stepId property: The job step's index within the job. If not specified when creating the job step, it + * will be created as the last step. If not specified when updating the job step, the step id is not modified. + * + * @return the stepId value. + */ + Integer stepId(); + + /** + * Gets the targetGroup property: The resource ID of the target group that the job step will be executed on. + * + * @return the targetGroup value. + */ + String targetGroup(); + + /** + * Gets the credential property: The resource ID of the job credential that will be used to connect to the targets. + * + * @return the credential value. + */ + String credential(); + + /** + * Gets the action property: The action payload of the job step. + * + * @return the action value. + */ + JobStepAction action(); + + /** + * Gets the output property: Output destination properties of the job step. + * + * @return the output value. + */ + JobStepOutput output(); + + /** + * Gets the executionOptions property: Execution options for the job step. + * + * @return the executionOptions value. + */ + JobStepExecutionOptions executionOptions(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner object. + * + * @return the inner object. + */ + JobStepInner innerModel(); + + /** The entirety of the JobStep definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobStep definition stages. */ + interface DefinitionStages { + /** The first stage of the JobStep definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobStep definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName, jobName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @return the next definition stage. + */ + WithCreate withExistingJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + } + /** + * The stage of the JobStep 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.WithStepId, + DefinitionStages.WithTargetGroup, + DefinitionStages.WithCredential, + DefinitionStages.WithAction, + DefinitionStages.WithOutput, + DefinitionStages.WithExecutionOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobStep create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobStep create(Context context); + } + /** The stage of the JobStep definition allowing to specify stepId. */ + interface WithStepId { + /** + * Specifies the stepId property: The job step's index within the job. If not specified when creating the + * job step, it will be created as the last step. If not specified when updating the job step, the step id + * is not modified.. + * + * @param stepId The job step's index within the job. If not specified when creating the job step, it will + * be created as the last step. If not specified when updating the job step, the step id is not + * modified. + * @return the next definition stage. + */ + WithCreate withStepId(Integer stepId); + } + /** The stage of the JobStep definition allowing to specify targetGroup. */ + interface WithTargetGroup { + /** + * Specifies the targetGroup property: The resource ID of the target group that the job step will be + * executed on.. + * + * @param targetGroup The resource ID of the target group that the job step will be executed on. + * @return the next definition stage. + */ + WithCreate withTargetGroup(String targetGroup); + } + /** The stage of the JobStep definition allowing to specify credential. */ + interface WithCredential { + /** + * Specifies the credential property: The resource ID of the job credential that will be used to connect to + * the targets.. + * + * @param credential The resource ID of the job credential that will be used to connect to the targets. + * @return the next definition stage. + */ + WithCreate withCredential(String credential); + } + /** The stage of the JobStep definition allowing to specify action. */ + interface WithAction { + /** + * Specifies the action property: The action payload of the job step.. + * + * @param action The action payload of the job step. + * @return the next definition stage. + */ + WithCreate withAction(JobStepAction action); + } + /** The stage of the JobStep definition allowing to specify output. */ + interface WithOutput { + /** + * Specifies the output property: Output destination properties of the job step.. + * + * @param output Output destination properties of the job step. + * @return the next definition stage. + */ + WithCreate withOutput(JobStepOutput output); + } + /** The stage of the JobStep definition allowing to specify executionOptions. */ + interface WithExecutionOptions { + /** + * Specifies the executionOptions property: Execution options for the job step.. + * + * @param executionOptions Execution options for the job step. + * @return the next definition stage. + */ + WithCreate withExecutionOptions(JobStepExecutionOptions executionOptions); + } + } + /** + * Begins update for the JobStep resource. + * + * @return the stage of resource update. + */ + JobStep.Update update(); + + /** The template for JobStep update. */ + interface Update + extends UpdateStages.WithStepId, + UpdateStages.WithTargetGroup, + UpdateStages.WithCredential, + UpdateStages.WithAction, + UpdateStages.WithOutput, + UpdateStages.WithExecutionOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobStep apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobStep apply(Context context); + } + /** The JobStep update stages. */ + interface UpdateStages { + /** The stage of the JobStep update allowing to specify stepId. */ + interface WithStepId { + /** + * Specifies the stepId property: The job step's index within the job. If not specified when creating the + * job step, it will be created as the last step. If not specified when updating the job step, the step id + * is not modified.. + * + * @param stepId The job step's index within the job. If not specified when creating the job step, it will + * be created as the last step. If not specified when updating the job step, the step id is not + * modified. + * @return the next definition stage. + */ + Update withStepId(Integer stepId); + } + /** The stage of the JobStep update allowing to specify targetGroup. */ + interface WithTargetGroup { + /** + * Specifies the targetGroup property: The resource ID of the target group that the job step will be + * executed on.. + * + * @param targetGroup The resource ID of the target group that the job step will be executed on. + * @return the next definition stage. + */ + Update withTargetGroup(String targetGroup); + } + /** The stage of the JobStep update allowing to specify credential. */ + interface WithCredential { + /** + * Specifies the credential property: The resource ID of the job credential that will be used to connect to + * the targets.. + * + * @param credential The resource ID of the job credential that will be used to connect to the targets. + * @return the next definition stage. + */ + Update withCredential(String credential); + } + /** The stage of the JobStep update allowing to specify action. */ + interface WithAction { + /** + * Specifies the action property: The action payload of the job step.. + * + * @param action The action payload of the job step. + * @return the next definition stage. + */ + Update withAction(JobStepAction action); + } + /** The stage of the JobStep update allowing to specify output. */ + interface WithOutput { + /** + * Specifies the output property: Output destination properties of the job step.. + * + * @param output Output destination properties of the job step. + * @return the next definition stage. + */ + Update withOutput(JobStepOutput output); + } + /** The stage of the JobStep update allowing to specify executionOptions. */ + interface WithExecutionOptions { + /** + * Specifies the executionOptions property: Execution options for the job step.. + * + * @param executionOptions Execution options for the job step. + * @return the next definition stage. + */ + Update withExecutionOptions(JobStepExecutionOptions executionOptions); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobStep refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobStep refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.java new file mode 100644 index 0000000000000..1a4039340714c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 action to be executed by a job step. */ +@Fluent +public final class JobStepAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStepAction.class); + + /* + * Type of action being executed by the job step. + */ + @JsonProperty(value = "type") + private JobStepActionType type; + + /* + * The source of the action to execute. + */ + @JsonProperty(value = "source") + private JobStepActionSource source; + + /* + * The action value, for example the text of the T-SQL script to execute. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the type property: Type of action being executed by the job step. + * + * @return the type value. + */ + public JobStepActionType type() { + return this.type; + } + + /** + * Set the type property: Type of action being executed by the job step. + * + * @param type the type value to set. + * @return the JobStepAction object itself. + */ + public JobStepAction withType(JobStepActionType type) { + this.type = type; + return this; + } + + /** + * Get the source property: The source of the action to execute. + * + * @return the source value. + */ + public JobStepActionSource source() { + return this.source; + } + + /** + * Set the source property: The source of the action to execute. + * + * @param source the source value to set. + * @return the JobStepAction object itself. + */ + public JobStepAction withSource(JobStepActionSource source) { + this.source = source; + return this; + } + + /** + * Get the value property: The action value, for example the text of the T-SQL script to execute. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The action value, for example the text of the T-SQL script to execute. + * + * @param value the value value to set. + * @return the JobStepAction object itself. + */ + public JobStepAction withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model JobStepAction")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionSource.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionSource.java new file mode 100644 index 0000000000000..64a8de26250b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionSource.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobStepActionSource. */ +public final class JobStepActionSource extends ExpandableStringEnum { + /** Static value Inline for JobStepActionSource. */ + public static final JobStepActionSource INLINE = fromString("Inline"); + + /** + * Creates or finds a JobStepActionSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobStepActionSource. + */ + @JsonCreator + public static JobStepActionSource fromString(String name) { + return fromString(name, JobStepActionSource.class); + } + + /** @return known JobStepActionSource values. */ + public static Collection values() { + return values(JobStepActionSource.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionType.java new file mode 100644 index 0000000000000..6a5bfba7a5099 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobStepActionType. */ +public final class JobStepActionType extends ExpandableStringEnum { + /** Static value TSql for JobStepActionType. */ + public static final JobStepActionType TSQL = fromString("TSql"); + + /** + * Creates or finds a JobStepActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobStepActionType. + */ + @JsonCreator + public static JobStepActionType fromString(String name) { + return fromString(name, JobStepActionType.class); + } + + /** @return known JobStepActionType values. */ + public static Collection values() { + return values(JobStepActionType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.java new file mode 100644 index 0000000000000..b65f8c964ba77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 execution options of a job step. */ +@Fluent +public final class JobStepExecutionOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStepExecutionOptions.class); + + /* + * Execution timeout for the job step. + */ + @JsonProperty(value = "timeoutSeconds") + private Integer timeoutSeconds; + + /* + * Maximum number of times the job step will be reattempted if the first + * attempt fails. + */ + @JsonProperty(value = "retryAttempts") + private Integer retryAttempts; + + /* + * Initial delay between retries for job step execution. + */ + @JsonProperty(value = "initialRetryIntervalSeconds") + private Integer initialRetryIntervalSeconds; + + /* + * The maximum amount of time to wait between retries for job step + * execution. + */ + @JsonProperty(value = "maximumRetryIntervalSeconds") + private Integer maximumRetryIntervalSeconds; + + /* + * The backoff multiplier for the time between retries. + */ + @JsonProperty(value = "retryIntervalBackoffMultiplier") + private Float retryIntervalBackoffMultiplier; + + /** + * Get the timeoutSeconds property: Execution timeout for the job step. + * + * @return the timeoutSeconds value. + */ + public Integer timeoutSeconds() { + return this.timeoutSeconds; + } + + /** + * Set the timeoutSeconds property: Execution timeout for the job step. + * + * @param timeoutSeconds the timeoutSeconds value to set. + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withTimeoutSeconds(Integer timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + /** + * Get the retryAttempts property: Maximum number of times the job step will be reattempted if the first attempt + * fails. + * + * @return the retryAttempts value. + */ + public Integer retryAttempts() { + return this.retryAttempts; + } + + /** + * Set the retryAttempts property: Maximum number of times the job step will be reattempted if the first attempt + * fails. + * + * @param retryAttempts the retryAttempts value to set. + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryAttempts(Integer retryAttempts) { + this.retryAttempts = retryAttempts; + return this; + } + + /** + * Get the initialRetryIntervalSeconds property: Initial delay between retries for job step execution. + * + * @return the initialRetryIntervalSeconds value. + */ + public Integer initialRetryIntervalSeconds() { + return this.initialRetryIntervalSeconds; + } + + /** + * Set the initialRetryIntervalSeconds property: Initial delay between retries for job step execution. + * + * @param initialRetryIntervalSeconds the initialRetryIntervalSeconds value to set. + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withInitialRetryIntervalSeconds(Integer initialRetryIntervalSeconds) { + this.initialRetryIntervalSeconds = initialRetryIntervalSeconds; + return this; + } + + /** + * Get the maximumRetryIntervalSeconds property: The maximum amount of time to wait between retries for job step + * execution. + * + * @return the maximumRetryIntervalSeconds value. + */ + public Integer maximumRetryIntervalSeconds() { + return this.maximumRetryIntervalSeconds; + } + + /** + * Set the maximumRetryIntervalSeconds property: The maximum amount of time to wait between retries for job step + * execution. + * + * @param maximumRetryIntervalSeconds the maximumRetryIntervalSeconds value to set. + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withMaximumRetryIntervalSeconds(Integer maximumRetryIntervalSeconds) { + this.maximumRetryIntervalSeconds = maximumRetryIntervalSeconds; + return this; + } + + /** + * Get the retryIntervalBackoffMultiplier property: The backoff multiplier for the time between retries. + * + * @return the retryIntervalBackoffMultiplier value. + */ + public Float retryIntervalBackoffMultiplier() { + return this.retryIntervalBackoffMultiplier; + } + + /** + * Set the retryIntervalBackoffMultiplier property: The backoff multiplier for the time between retries. + * + * @param retryIntervalBackoffMultiplier the retryIntervalBackoffMultiplier value to set. + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryIntervalBackoffMultiplier(Float retryIntervalBackoffMultiplier) { + this.retryIntervalBackoffMultiplier = retryIntervalBackoffMultiplier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutions.java new file mode 100644 index 0000000000000..22e5b4798352b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutions.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Resource collection API of JobStepExecutions. */ +public interface JobStepExecutions { + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @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 step execution of a job execution. + */ + JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @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 step execution of a job execution. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.java new file mode 100644 index 0000000000000..408377dcf8a09 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job steps. */ +@Immutable +public final class JobStepListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStepListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.java new file mode 100644 index 0000000000000..cdf660923cb81 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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.UUID; + +/** The output configuration of a job step. */ +@Fluent +public final class JobStepOutput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStepOutput.class); + + /* + * The output destination type. + */ + @JsonProperty(value = "type") + private JobStepOutputType type; + + /* + * The output destination subscription id. + */ + @JsonProperty(value = "subscriptionId") + private UUID subscriptionId; + + /* + * The output destination resource group. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /* + * The output destination server name. + */ + @JsonProperty(value = "serverName", required = true) + private String serverName; + + /* + * The output destination database. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /* + * The output destination schema. + */ + @JsonProperty(value = "schemaName") + private String schemaName; + + /* + * The output destination table. + */ + @JsonProperty(value = "tableName", required = true) + private String tableName; + + /* + * The resource ID of the credential to use to connect to the output + * destination. + */ + @JsonProperty(value = "credential", required = true) + private String credential; + + /** + * Get the type property: The output destination type. + * + * @return the type value. + */ + public JobStepOutputType type() { + return this.type; + } + + /** + * Set the type property: The output destination type. + * + * @param type the type value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withType(JobStepOutputType type) { + this.type = type; + return this; + } + + /** + * Get the subscriptionId property: The output destination subscription id. + * + * @return the subscriptionId value. + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The output destination subscription id. + * + * @param subscriptionId the subscriptionId value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSubscriptionId(UUID subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroupName property: The output destination resource group. + * + * @return the resourceGroupName value. + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resourceGroupName property: The output destination resource group. + * + * @param resourceGroupName the resourceGroupName value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the serverName property: The output destination server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName property: The output destination server name. + * + * @param serverName the serverName value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName property: The output destination database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The output destination database. + * + * @param databaseName the databaseName value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the schemaName property: The output destination schema. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the schemaName property: The output destination schema. + * + * @param schemaName the schemaName value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the tableName property: The output destination table. + * + * @return the tableName value. + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the tableName property: The output destination table. + * + * @param tableName the tableName value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the credential property: The resource ID of the credential to use to connect to the output destination. + * + * @return the credential value. + */ + public String credential() { + return this.credential; + } + + /** + * Set the credential property: The resource ID of the credential to use to connect to the output destination. + * + * @param credential the credential value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withCredential(String credential) { + this.credential = credential; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property serverName in model JobStepOutput")); + } + if (databaseName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property databaseName in model JobStepOutput")); + } + if (tableName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property tableName in model JobStepOutput")); + } + if (credential() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property credential in model JobStepOutput")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutputType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutputType.java new file mode 100644 index 0000000000000..ff1ee55dd8ffa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutputType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobStepOutputType. */ +public final class JobStepOutputType extends ExpandableStringEnum { + /** Static value SqlDatabase for JobStepOutputType. */ + public static final JobStepOutputType SQL_DATABASE = fromString("SqlDatabase"); + + /** + * Creates or finds a JobStepOutputType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobStepOutputType. + */ + @JsonCreator + public static JobStepOutputType fromString(String name) { + return fromString(name, JobStepOutputType.class); + } + + /** @return known JobStepOutputType values. */ + public static Collection values() { + return values(JobStepOutputType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSteps.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSteps.java new file mode 100644 index 0000000000000..83a570054f191 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSteps.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 JobSteps. */ +public interface JobSteps { + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 job steps in the specified job version. + */ + PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 job steps in the specified job version. + */ + PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 specified version of a job step. + */ + JobStep getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName); + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 specified version of a job step. + */ + Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context); + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job steps for a job's current version. + */ + PagedIterable listByJob(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job steps for a job's current version. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 job step in a job's current version. + */ + JobStep get(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 job step in a job's current version. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, String jobAgentName, String jobName, String stepName); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); + + /** + * Gets a job step in a job's current version. + * + * @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 job step in a job's current version. + */ + JobStep getById(String id); + + /** + * Gets a job step in a job's current version. + * + * @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 job step in a job's current version. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @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 job step. This will implicitly create a new job version. + * + * @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 JobStep resource. + * + * @param name resource name. + * @return the first stage of the new JobStep definition. + */ + JobStep.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java new file mode 100644 index 0000000000000..56462cbfd9211 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** A job target, for example a specific database or a container of databases that is evaluated during job execution. */ +@Fluent +public final class JobTarget { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobTarget.class); + + /* + * Whether the target is included or excluded from the group. + */ + @JsonProperty(value = "membershipType") + private JobTargetGroupMembershipType membershipType; + + /* + * The target type. + */ + @JsonProperty(value = "type", required = true) + private JobTargetType type; + + /* + * The target server name. + */ + @JsonProperty(value = "serverName") + private String serverName; + + /* + * The target database name. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The target elastic pool name. + */ + @JsonProperty(value = "elasticPoolName") + private String elasticPoolName; + + /* + * The target shard map. + */ + @JsonProperty(value = "shardMapName") + private String shardMapName; + + /* + * The resource ID of the credential that is used during job execution to + * connect to the target and determine the list of databases inside the + * target. + */ + @JsonProperty(value = "refreshCredential") + private String refreshCredential; + + /** + * Get the membershipType property: Whether the target is included or excluded from the group. + * + * @return the membershipType value. + */ + public JobTargetGroupMembershipType membershipType() { + return this.membershipType; + } + + /** + * Set the membershipType property: Whether the target is included or excluded from the group. + * + * @param membershipType the membershipType value to set. + * @return the JobTarget object itself. + */ + public JobTarget withMembershipType(JobTargetGroupMembershipType membershipType) { + this.membershipType = membershipType; + return this; + } + + /** + * Get the type property: The target type. + * + * @return the type value. + */ + public JobTargetType type() { + return this.type; + } + + /** + * Set the type property: The target type. + * + * @param type the type value to set. + * @return the JobTarget object itself. + */ + public JobTarget withType(JobTargetType type) { + this.type = type; + return this; + } + + /** + * Get the serverName property: The target server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName property: The target server name. + * + * @param serverName the serverName value to set. + * @return the JobTarget object itself. + */ + public JobTarget withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName property: The target database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The target database name. + * + * @param databaseName the databaseName value to set. + * @return the JobTarget object itself. + */ + public JobTarget withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the elasticPoolName property: The target elastic pool name. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the elasticPoolName property: The target elastic pool name. + * + * @param elasticPoolName the elasticPoolName value to set. + * @return the JobTarget object itself. + */ + public JobTarget withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the shardMapName property: The target shard map. + * + * @return the shardMapName value. + */ + public String shardMapName() { + return this.shardMapName; + } + + /** + * Set the shardMapName property: The target shard map. + * + * @param shardMapName the shardMapName value to set. + * @return the JobTarget object itself. + */ + public JobTarget withShardMapName(String shardMapName) { + this.shardMapName = shardMapName; + return this; + } + + /** + * Get the refreshCredential property: The resource ID of the credential that is used during job execution to + * connect to the target and determine the list of databases inside the target. + * + * @return the refreshCredential value. + */ + public String refreshCredential() { + return this.refreshCredential; + } + + /** + * Set the refreshCredential property: The resource ID of the credential that is used during job execution to + * connect to the target and determine the list of databases inside the target. + * + * @param refreshCredential the refreshCredential value to set. + * @return the JobTarget object itself. + */ + public JobTarget withRefreshCredential(String refreshCredential) { + this.refreshCredential = refreshCredential; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model JobTarget")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetExecutions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetExecutions.java new file mode 100644 index 0000000000000..0f7941bc93713 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetExecutions.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Resource collection API of JobTargetExecutions. */ +public interface JobTargetExecutions { + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution. + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions. + */ + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target 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 target execution. + */ + JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId); + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution. + * @param stepName The name of the step. + * @param targetId The target 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 target execution. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroup.java new file mode 100644 index 0000000000000..2532069ac2617 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroup.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import java.util.List; + +/** An immutable client-side representation of JobTargetGroup. */ +public interface JobTargetGroup { + /** + * 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 members property: Members of the target group. + * + * @return the members value. + */ + List members(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner object. + * + * @return the inner object. + */ + JobTargetGroupInner innerModel(); + + /** The entirety of the JobTargetGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobTargetGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the JobTargetGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobTargetGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @return the next definition stage. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + /** + * The stage of the JobTargetGroup 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.WithMembers { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobTargetGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobTargetGroup create(Context context); + } + /** The stage of the JobTargetGroup definition allowing to specify members. */ + interface WithMembers { + /** + * Specifies the members property: Members of the target group.. + * + * @param members Members of the target group. + * @return the next definition stage. + */ + WithCreate withMembers(List members); + } + } + /** + * Begins update for the JobTargetGroup resource. + * + * @return the stage of resource update. + */ + JobTargetGroup.Update update(); + + /** The template for JobTargetGroup update. */ + interface Update extends UpdateStages.WithMembers { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobTargetGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobTargetGroup apply(Context context); + } + /** The JobTargetGroup update stages. */ + interface UpdateStages { + /** The stage of the JobTargetGroup update allowing to specify members. */ + interface WithMembers { + /** + * Specifies the members property: Members of the target group.. + * + * @param members Members of the target group. + * @return the next definition stage. + */ + Update withMembers(List members); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobTargetGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobTargetGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.java new file mode 100644 index 0000000000000..f826ed45b6072 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of target groups. */ +@Immutable +public final class JobTargetGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobTargetGroupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupMembershipType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupMembershipType.java new file mode 100644 index 0000000000000..e1a5d5ddf2c61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupMembershipType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobTargetGroupMembershipType. */ +public enum JobTargetGroupMembershipType { + /** Enum value Include. */ + INCLUDE("Include"), + + /** Enum value Exclude. */ + EXCLUDE("Exclude"); + + /** The actual serialized value for a JobTargetGroupMembershipType instance. */ + private final String value; + + JobTargetGroupMembershipType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobTargetGroupMembershipType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobTargetGroupMembershipType object, or null if unable to parse. + */ + @JsonCreator + public static JobTargetGroupMembershipType fromString(String value) { + JobTargetGroupMembershipType[] items = JobTargetGroupMembershipType.values(); + for (JobTargetGroupMembershipType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroups.java new file mode 100644 index 0000000000000..a032128de7a5b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroups.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.sql.generated.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 JobTargetGroups. */ +public interface JobTargetGroups { + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 target groups in an agent. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 target groups in an agent. + */ + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + JobTargetGroup get(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); + + /** + * Gets a target group. + * + * @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 target group. + */ + JobTargetGroup getById(String id); + + /** + * Gets a target group. + * + * @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 target group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a target group. + * + * @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 target group. + * + * @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 JobTargetGroup resource. + * + * @param name resource name. + * @return the first stage of the new JobTargetGroup definition. + */ + JobTargetGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetType.java new file mode 100644 index 0000000000000..658b7c3181164 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobTargetType. */ +public final class JobTargetType extends ExpandableStringEnum { + /** Static value TargetGroup for JobTargetType. */ + public static final JobTargetType TARGET_GROUP = fromString("TargetGroup"); + + /** Static value SqlDatabase for JobTargetType. */ + public static final JobTargetType SQL_DATABASE = fromString("SqlDatabase"); + + /** Static value SqlElasticPool for JobTargetType. */ + public static final JobTargetType SQL_ELASTIC_POOL = fromString("SqlElasticPool"); + + /** Static value SqlShardMap for JobTargetType. */ + public static final JobTargetType SQL_SHARD_MAP = fromString("SqlShardMap"); + + /** Static value SqlServer for JobTargetType. */ + public static final JobTargetType SQL_SERVER = fromString("SqlServer"); + + /** + * Creates or finds a JobTargetType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobTargetType. + */ + @JsonCreator + public static JobTargetType fromString(String name) { + return fromString(name, JobTargetType.class); + } + + /** @return known JobTargetType values. */ + public static Collection values() { + return values(JobTargetType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersion.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersion.java new file mode 100644 index 0000000000000..d0f44f23b99d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersion.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; + +/** An immutable client-side representation of JobVersion. */ +public interface JobVersion { + /** + * 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 inner com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner object. + * + * @return the inner object. + */ + JobVersionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.java new file mode 100644 index 0000000000000..4b73a50c7068d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job versions. */ +@Immutable +public final class JobVersionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobVersionListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersions.java new file mode 100644 index 0000000000000..376d3a6ccd944 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersions.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 JobVersions. */ +public interface JobVersions { + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 versions of a job. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 versions of a job. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 job version. + */ + JobVersion get(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 job version. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Jobs.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Jobs.java new file mode 100644 index 0000000000000..b1efcaec58334 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Jobs.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 Jobs. */ +public interface Jobs { + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job. + */ + Job get(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 job. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName); + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName, Context context); + + /** + * Gets a job. + * + * @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 job. + */ + Job getById(String id); + + /** + * Gets a job. + * + * @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 job. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job. + * + * @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 job. + * + * @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 Job resource. + * + * @param name resource name. + * @return the first stage of the new Job definition. + */ + Job.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.java new file mode 100644 index 0000000000000..6d565438f6fb9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.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.sql.generated.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 license type capability. */ +@Fluent +public final class LicenseTypeCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LicenseTypeCapability.class); + + /* + * License type identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: License type identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the LicenseTypeCapability object itself. + */ + public LicenseTypeCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LocationCapabilities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LocationCapabilities.java new file mode 100644 index 0000000000000..05a842f433498 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LocationCapabilities.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import java.util.List; + +/** An immutable client-side representation of LocationCapabilities. */ +public interface LocationCapabilities { + /** + * Gets the name property: The location name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the supportedServerVersions property: The list of supported server versions. + * + * @return the supportedServerVersions value. + */ + List supportedServerVersions(); + + /** + * Gets the supportedManagedInstanceVersions property: The list of supported managed instance versions. + * + * @return the supportedManagedInstanceVersions value. + */ + List supportedManagedInstanceVersions(); + + /** + * Gets the status property: The status of the capability. + * + * @return the status value. + */ + CapabilityStatus status(); + + /** + * Gets the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner object. + * + * @return the inner object. + */ + LocationCapabilitiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.java new file mode 100644 index 0000000000000..61abc62b1861d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The log size capability. */ +@Immutable +public final class LogSizeCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSizeCapability.class); + + /* + * The log size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /* + * The units that the limit is expressed in. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeUnit unit; + + /** + * Get the limit property: The log size limit (see 'unit' for the units). + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the unit property: The units that the limit is expressed in. + * + * @return the unit value. + */ + public LogSizeUnit unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeUnit.java new file mode 100644 index 0000000000000..2fc58e4776914 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeUnit.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LogSizeUnit. */ +public final class LogSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for LogSizeUnit. */ + public static final LogSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for LogSizeUnit. */ + public static final LogSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for LogSizeUnit. */ + public static final LogSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for LogSizeUnit. */ + public static final LogSizeUnit PETABYTES = fromString("Petabytes"); + + /** Static value Percent for LogSizeUnit. */ + public static final LogSizeUnit PERCENT = fromString("Percent"); + + /** + * Creates or finds a LogSizeUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding LogSizeUnit. + */ + @JsonCreator + public static LogSizeUnit fromString(String name) { + return fromString(name, LogSizeUnit.class); + } + + /** @return known LogSizeUnit values. */ + public static Collection values() { + return values(LogSizeUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.java new file mode 100644 index 0000000000000..73487bdcf2327 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's security alert policies. */ +@Immutable +public final class LogicalServerSecurityAlertPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogicalServerSecurityAlertPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackup.java new file mode 100644 index 0000000000000..fcde28b640712 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackup.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LongTermRetentionBackup. */ +public interface LongTermRetentionBackup { + /** + * 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 serverName property: The server name that the backup database belong to. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the serverCreateTime property: The create time of the server. + * + * @return the serverCreateTime value. + */ + OffsetDateTime serverCreateTime(); + + /** + * Gets the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + OffsetDateTime databaseDeletionTime(); + + /** + * Gets the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + OffsetDateTime backupTime(); + + /** + * Gets the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + OffsetDateTime backupExpirationTime(); + + /** + * Gets the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + BackupStorageRedundancy backupStorageRedundancy(); + + /** + * Gets the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + BackupStorageRedundancy requestedBackupStorageRedundancy(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner object. + * + * @return the inner object. + */ + LongTermRetentionBackupInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.java new file mode 100644 index 0000000000000..54750c69e63ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups. */ +@Immutable +public final class LongTermRetentionBackupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionBackupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupOperationResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupOperationResult.java new file mode 100644 index 0000000000000..797cfd86f8452 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupOperationResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import java.util.UUID; + +/** An immutable client-side representation of LongTermRetentionBackupOperationResult. */ +public interface LongTermRetentionBackupOperationResult { + /** + * 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 requestId property: Request Id. + * + * @return the requestId value. + */ + UUID requestId(); + + /** + * Gets the operationType property: Operation type. + * + * @return the operationType value. + */ + String operationType(); + + /** + * Gets the fromBackupResourceId property: Source backup resource id. + * + * @return the fromBackupResourceId value. + */ + String fromBackupResourceId(); + + /** + * Gets the toBackupResourceId property: Target backup resource id. + * + * @return the toBackupResourceId value. + */ + String toBackupResourceId(); + + /** + * Gets the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + BackupStorageRedundancy targetBackupStorageRedundancy(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the message property: Progress message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner + * object. + * + * @return the inner object. + */ + LongTermRetentionBackupOperationResultInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackups.java new file mode 100644 index 0000000000000..26d4cf9ee8666 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackups.java @@ -0,0 +1,562 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 LongTermRetentionBackups. */ +public interface LongTermRetentionBackups { + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + LongTermRetentionBackup get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByLocation(String locationName); + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + PagedIterable listByServer(String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @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 LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + LongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByResourceGroupLocation(String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the 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 list of long term retention backups. + */ + PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups. + */ + PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.java new file mode 100644 index 0000000000000..47ef2ecf43cdd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 LongTermRetentionManagedInstanceBackups. */ +public interface LongTermRetentionManagedInstanceBackups { + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + ManagedInstanceLongTermRetentionBackup get( + String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByInstance( + String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByLocation(String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + ManagedInstanceLongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s). + */ + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicies.java new file mode 100644 index 0000000000000..324fde22f1329 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicies.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 LongTermRetentionPolicies. */ +public interface LongTermRetentionPolicies { + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 database's long term retention policy. + */ + LongTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 database's long term retention policy. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's long term retention policy. + * + * @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 database's long term retention policy. + */ + LongTermRetentionPolicy getById(String id); + + /** + * Gets a database's long term retention policy. + * + * @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 database's long term retention policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LongTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new LongTermRetentionPolicy definition. + */ + LongTermRetentionPolicy.DefinitionStages.Blank define(LongTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicy.java new file mode 100644 index 0000000000000..b7cb8ccfea63a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicy.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; + +/** An immutable client-side representation of LongTermRetentionPolicy. */ +public interface LongTermRetentionPolicy { + /** + * 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 weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + String weeklyRetention(); + + /** + * Gets the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + String monthlyRetention(); + + /** + * Gets the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + String yearlyRetention(); + + /** + * Gets the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + Integer weekOfYear(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner object. + * + * @return the inner object. + */ + LongTermRetentionPolicyInner innerModel(); + + /** The entirety of the LongTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LongTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the LongTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the LongTermRetentionPolicy 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.WithWeeklyRetention, + DefinitionStages.WithMonthlyRetention, + DefinitionStages.WithYearlyRetention, + DefinitionStages.WithWeekOfYear { + /** + * Executes the create request. + * + * @return the created resource. + */ + LongTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LongTermRetentionPolicy create(Context context); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeeklyRetention(String weeklyRetention); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withMonthlyRetention(String monthlyRetention); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withYearlyRetention(String yearlyRetention); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeekOfYear(Integer weekOfYear); + } + } + /** + * Begins update for the LongTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + LongTermRetentionPolicy.Update update(); + + /** The template for LongTermRetentionPolicy update. */ + interface Update + extends UpdateStages.WithWeeklyRetention, + UpdateStages.WithMonthlyRetention, + UpdateStages.WithYearlyRetention, + UpdateStages.WithWeekOfYear { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LongTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LongTermRetentionPolicy apply(Context context); + } + /** The LongTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the LongTermRetentionPolicy update allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeeklyRetention(String weeklyRetention); + } + /** The stage of the LongTermRetentionPolicy update allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withMonthlyRetention(String monthlyRetention); + } + /** The stage of the LongTermRetentionPolicy update allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withYearlyRetention(String yearlyRetention); + } + /** The stage of the LongTermRetentionPolicy update allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeekOfYear(Integer weekOfYear); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LongTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LongTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..4a2f6bd5ed9cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention policies. */ +@Immutable +public final class LongTermRetentionPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LongTermRetentionPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyName.java new file mode 100644 index 0000000000000..60b88732ac3b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LongTermRetentionPolicyName. */ +public final class LongTermRetentionPolicyName extends ExpandableStringEnum { + /** Static value default for LongTermRetentionPolicyName. */ + public static final LongTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a LongTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LongTermRetentionPolicyName. + */ + @JsonCreator + public static LongTermRetentionPolicyName fromString(String name) { + return fromString(name, LongTermRetentionPolicyName.class); + } + + /** @return known LongTermRetentionPolicyName values. */ + public static Collection values() { + return values(LongTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.java new file mode 100644 index 0000000000000..4ac4e6af695bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 maintenance configuration capability. */ +@Fluent +public final class MaintenanceConfigurationCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MaintenanceConfigurationCapability.class); + + /* + * Maintenance configuration name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether or not zone redundancy is supported for the maintenance + * configuration. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: Maintenance configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the maintenance configuration. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the MaintenanceConfigurationCapability object itself. + */ + public MaintenanceConfigurationCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..9d4a557896b35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicies.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedBackupShortTermRetentionPolicies. */ +public interface ManagedBackupShortTermRetentionPolicies { + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName); + + /** + * Gets a managed database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database's short term retention policy list. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a managed database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database's short term retention policy list. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's short term retention policy. + * + * @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 managed database's short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy getById(String id); + + /** + * Gets a managed database's short term retention policy. + * + * @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 managed database's short term retention policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedBackupShortTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedBackupShortTermRetentionPolicy definition. + */ + ManagedBackupShortTermRetentionPolicy.DefinitionStages.Blank define(ManagedShortTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..4b255c6ba6beb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; + +/** An immutable client-side representation of ManagedBackupShortTermRetentionPolicy. */ +public interface ManagedBackupShortTermRetentionPolicy { + /** + * 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 retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner + * object. + * + * @return the inner object. + */ + ManagedBackupShortTermRetentionPolicyInner innerModel(); + + /** The entirety of the ManagedBackupShortTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedBackupShortTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedBackupShortTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedBackupShortTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedBackupShortTermRetentionPolicy 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.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedBackupShortTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedBackupShortTermRetentionPolicy create(Context context); + } + /** The stage of the ManagedBackupShortTermRetentionPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ManagedBackupShortTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + ManagedBackupShortTermRetentionPolicy.Update update(); + + /** The template for ManagedBackupShortTermRetentionPolicy update. */ + interface Update extends UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedBackupShortTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedBackupShortTermRetentionPolicy apply(Context context); + } + /** The ManagedBackupShortTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedBackupShortTermRetentionPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedBackupShortTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedBackupShortTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..92b57109c6288 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of short term retention policies. */ +@Immutable +public final class ManagedBackupShortTermRetentionPolicyListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedBackupShortTermRetentionPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java new file mode 100644 index 0000000000000..d8cb8d850cd05 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java @@ -0,0 +1,642 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of ManagedDatabase. */ +public interface ManagedDatabase { + /** + * 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 collation property: Collation of the managed database. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the status property: Status of the database. + * + * @return the status value. + */ + ManagedDatabaseStatus status(); + + /** + * Gets the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + OffsetDateTime earliestRestorePoint(); + + /** + * Gets the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + OffsetDateTime restorePointInTime(); + + /** + * Gets the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * Gets the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * Gets the createMode property: Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must + * be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, + * StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a + * geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to + * restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @return the createMode value. + */ + ManagedDatabaseCreateMode createMode(); + + /** + * Gets the storageContainerUri property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @return the storageContainerUri value. + */ + String storageContainerUri(); + + /** + * Gets the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * Gets the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * Gets the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + * + * @return the storageContainerSasToken value. + */ + String storageContainerSasToken(); + + /** + * Gets the failoverGroupId property: Instance Failover Group resource identifier that this managed database belongs + * to. + * + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * Gets the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * Gets the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * Gets the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @return the autoCompleteRestore value. + */ + Boolean autoCompleteRestore(); + + /** + * Gets the lastBackupName property: Last backup file name for restore of this managed database. + * + * @return the lastBackupName value. + */ + String lastBackupName(); + + /** + * 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.sql.generated.fluent.models.ManagedDatabaseInner object. + * + * @return the inner object. + */ + ManagedDatabaseInner innerModel(); + + /** The entirety of the ManagedDatabase definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The ManagedDatabase definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedDatabase definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ManagedDatabase 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ManagedDatabase definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedDatabase 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.WithCollation, + DefinitionStages.WithRestorePointInTime, + DefinitionStages.WithCatalogCollation, + DefinitionStages.WithCreateMode, + DefinitionStages.WithStorageContainerUri, + DefinitionStages.WithSourceDatabaseId, + DefinitionStages.WithRestorableDroppedDatabaseId, + DefinitionStages.WithStorageContainerSasToken, + DefinitionStages.WithRecoverableDatabaseId, + DefinitionStages.WithLongTermRetentionBackupResourceId, + DefinitionStages.WithAutoCompleteRestore, + DefinitionStages.WithLastBackupName { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedDatabase create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedDatabase create(Context context); + } + /** The stage of the ManagedDatabase 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 ManagedDatabase definition allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: Collation of the managed database.. + * + * @param collation Collation of the managed database. + * @return the next definition stage. + */ + WithCreate withCollation(String collation); + } + /** The stage of the ManagedDatabase definition allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value + * is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to + * create the new database.. + * + * @param restorePointInTime Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create + * the new database. + * @return the next definition stage. + */ + WithCreate withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the ManagedDatabase definition allowing to specify catalogCollation. */ + interface WithCatalogCollation { + /** + * Specifies the catalogCollation property: Collation of the metadata catalog.. + * + * @param catalogCollation Collation of the metadata catalog. + * @return the next definition stage. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + /** The stage of the ManagedDatabase definition allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName + * and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external + * backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: + * Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the + * recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by + * restoring from a long term retention backup (longTermRetentionBackupResourceId required).. + * + * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and + * PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external + * backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. + * Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create + * a database by restoring from a long term retention backup (longTermRetentionBackupResourceId + * required). + * @return the next definition stage. + */ + WithCreate withCreateMode(ManagedDatabaseCreateMode createMode); + } + /** The stage of the ManagedDatabase definition allowing to specify storageContainerUri. */ + interface WithStorageContainerUri { + /** + * Specifies the storageContainerUri property: Conditional. If createMode is RestoreExternalBackup, this + * value is required. Specifies the uri of the storage container where backups for this restore are stored.. + * + * @param storageContainerUri Conditional. If createMode is RestoreExternalBackup, this value is required. + * Specifies the uri of the storage container where backups for this restore are stored. + * @return the next definition stage. + */ + WithCreate withStorageContainerUri(String storageContainerUri); + } + /** The stage of the ManagedDatabase definition allowing to specify sourceDatabaseId. */ + interface WithSourceDatabaseId { + /** + * Specifies the sourceDatabaseId property: The resource identifier of the source database associated with + * create operation of this database.. + * + * @param sourceDatabaseId The resource identifier of the source database associated with create operation + * of this database. + * @return the next definition stage. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + /** The stage of the ManagedDatabase definition allowing to specify restorableDroppedDatabaseId. */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies the restorableDroppedDatabaseId property: The restorable dropped database resource id to + * restore when creating this database.. + * + * @param restorableDroppedDatabaseId The restorable dropped database resource id to restore when creating + * this database. + * @return the next definition stage. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** The stage of the ManagedDatabase definition allowing to specify storageContainerSasToken. */ + interface WithStorageContainerSasToken { + /** + * Specifies the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup, + * this value is required. Specifies the storage container sas token.. + * + * @param storageContainerSasToken Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasToken(String storageContainerSasToken); + } + /** The stage of the ManagedDatabase definition allowing to specify recoverableDatabaseId. */ + interface WithRecoverableDatabaseId { + /** + * Specifies the recoverableDatabaseId property: The resource identifier of the recoverable database + * associated with create operation of this database.. + * + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create + * operation of this database. + * @return the next definition stage. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + /** The stage of the ManagedDatabase definition allowing to specify longTermRetentionBackupResourceId. */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to + * be used for restore of this managed database.. + * + * @param longTermRetentionBackupResourceId The name of the Long Term Retention backup to be used for + * restore of this managed database. + * @return the next definition stage. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + /** The stage of the ManagedDatabase definition allowing to specify autoCompleteRestore. */ + interface WithAutoCompleteRestore { + /** + * Specifies the autoCompleteRestore property: Whether to auto complete restore of this managed database.. + * + * @param autoCompleteRestore Whether to auto complete restore of this managed database. + * @return the next definition stage. + */ + WithCreate withAutoCompleteRestore(Boolean autoCompleteRestore); + } + /** The stage of the ManagedDatabase definition allowing to specify lastBackupName. */ + interface WithLastBackupName { + /** + * Specifies the lastBackupName property: Last backup file name for restore of this managed database.. + * + * @param lastBackupName Last backup file name for restore of this managed database. + * @return the next definition stage. + */ + WithCreate withLastBackupName(String lastBackupName); + } + } + /** + * Begins update for the ManagedDatabase resource. + * + * @return the stage of resource update. + */ + ManagedDatabase.Update update(); + + /** The template for ManagedDatabase update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithCollation, + UpdateStages.WithRestorePointInTime, + UpdateStages.WithCatalogCollation, + UpdateStages.WithCreateMode, + UpdateStages.WithStorageContainerUri, + UpdateStages.WithSourceDatabaseId, + UpdateStages.WithRestorableDroppedDatabaseId, + UpdateStages.WithStorageContainerSasToken, + UpdateStages.WithRecoverableDatabaseId, + UpdateStages.WithLongTermRetentionBackupResourceId, + UpdateStages.WithLastBackupName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedDatabase apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedDatabase apply(Context context); + } + /** The ManagedDatabase update stages. */ + interface UpdateStages { + /** The stage of the ManagedDatabase update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ManagedDatabase update allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: Collation of the managed database.. + * + * @param collation Collation of the managed database. + * @return the next definition stage. + */ + Update withCollation(String collation); + } + /** The stage of the ManagedDatabase update allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value + * is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to + * create the new database.. + * + * @param restorePointInTime Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create + * the new database. + * @return the next definition stage. + */ + Update withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the ManagedDatabase update allowing to specify catalogCollation. */ + interface WithCatalogCollation { + /** + * Specifies the catalogCollation property: Collation of the metadata catalog.. + * + * @param catalogCollation Collation of the metadata catalog. + * @return the next definition stage. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + /** The stage of the ManagedDatabase update allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName + * and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external + * backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: + * Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the + * recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by + * restoring from a long term retention backup (longTermRetentionBackupResourceId required).. + * + * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and + * PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external + * backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. + * Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create + * a database by restoring from a long term retention backup (longTermRetentionBackupResourceId + * required). + * @return the next definition stage. + */ + Update withCreateMode(ManagedDatabaseCreateMode createMode); + } + /** The stage of the ManagedDatabase update allowing to specify storageContainerUri. */ + interface WithStorageContainerUri { + /** + * Specifies the storageContainerUri property: Conditional. If createMode is RestoreExternalBackup, this + * value is required. Specifies the uri of the storage container where backups for this restore are stored.. + * + * @param storageContainerUri Conditional. If createMode is RestoreExternalBackup, this value is required. + * Specifies the uri of the storage container where backups for this restore are stored. + * @return the next definition stage. + */ + Update withStorageContainerUri(String storageContainerUri); + } + /** The stage of the ManagedDatabase update allowing to specify sourceDatabaseId. */ + interface WithSourceDatabaseId { + /** + * Specifies the sourceDatabaseId property: The resource identifier of the source database associated with + * create operation of this database.. + * + * @param sourceDatabaseId The resource identifier of the source database associated with create operation + * of this database. + * @return the next definition stage. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + /** The stage of the ManagedDatabase update allowing to specify restorableDroppedDatabaseId. */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies the restorableDroppedDatabaseId property: The restorable dropped database resource id to + * restore when creating this database.. + * + * @param restorableDroppedDatabaseId The restorable dropped database resource id to restore when creating + * this database. + * @return the next definition stage. + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** The stage of the ManagedDatabase update allowing to specify storageContainerSasToken. */ + interface WithStorageContainerSasToken { + /** + * Specifies the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup, + * this value is required. Specifies the storage container sas token.. + * + * @param storageContainerSasToken Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + * @return the next definition stage. + */ + Update withStorageContainerSasToken(String storageContainerSasToken); + } + /** The stage of the ManagedDatabase update allowing to specify recoverableDatabaseId. */ + interface WithRecoverableDatabaseId { + /** + * Specifies the recoverableDatabaseId property: The resource identifier of the recoverable database + * associated with create operation of this database.. + * + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create + * operation of this database. + * @return the next definition stage. + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + /** The stage of the ManagedDatabase update allowing to specify longTermRetentionBackupResourceId. */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to + * be used for restore of this managed database.. + * + * @param longTermRetentionBackupResourceId The name of the Long Term Retention backup to be used for + * restore of this managed database. + * @return the next definition stage. + */ + Update withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + /** The stage of the ManagedDatabase update allowing to specify lastBackupName. */ + interface WithLastBackupName { + /** + * Specifies the lastBackupName property: Last backup file name for restore of this managed database.. + * + * @param lastBackupName Last backup file name for restore of this managed database. + * @return the next definition stage. + */ + Update withLastBackupName(String lastBackupName); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedDatabase refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedDatabase refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseCreateMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseCreateMode.java new file mode 100644 index 0000000000000..09a5b60ed7d5e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseCreateMode.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedDatabaseCreateMode. */ +public final class ManagedDatabaseCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode DEFAULT = fromString("Default"); + + /** Static value RestoreExternalBackup for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value PointInTimeRestore for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Recovery for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreLongTermRetentionBackup for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = + fromString("RestoreLongTermRetentionBackup"); + + /** + * Creates or finds a ManagedDatabaseCreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedDatabaseCreateMode. + */ + @JsonCreator + public static ManagedDatabaseCreateMode fromString(String name) { + return fromString(name, ManagedDatabaseCreateMode.class); + } + + /** @return known ManagedDatabaseCreateMode values. */ + public static Collection values() { + return values(ManagedDatabaseCreateMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.java new file mode 100644 index 0000000000000..712b6ca5f209e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed databases. */ +@Immutable +public final class ManagedDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetails.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetails.java new file mode 100644 index 0000000000000..cb41b4940df3d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetails.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseRestoreDetails. */ +public interface ManagedDatabaseRestoreDetails { + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @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 managed database restore details. + */ + ManagedDatabaseRestoreDetailsResult get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName); + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @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 managed database restore details. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsResult.java new file mode 100644 index 0000000000000..cc38a62d7eab0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsResult.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ManagedDatabaseRestoreDetailsResult. */ +public interface ManagedDatabaseRestoreDetailsResult { + /** + * 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 status property: Restore status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the currentRestoringFileName property: Current restoring file name. + * + * @return the currentRestoringFileName value. + */ + String currentRestoringFileName(); + + /** + * Gets the lastRestoredFileName property: Last restored file name. + * + * @return the lastRestoredFileName value. + */ + String lastRestoredFileName(); + + /** + * Gets the lastRestoredFileTime property: Last restored file time. + * + * @return the lastRestoredFileTime value. + */ + OffsetDateTime lastRestoredFileTime(); + + /** + * Gets the percentCompleted property: Percent completed. + * + * @return the percentCompleted value. + */ + Double percentCompleted(); + + /** + * Gets the unrestorableFiles property: List of unrestorable files. + * + * @return the unrestorableFiles value. + */ + List unrestorableFiles(); + + /** + * Gets the numberOfFilesDetected property: Number of files detected. + * + * @return the numberOfFilesDetected value. + */ + Long numberOfFilesDetected(); + + /** + * Gets the lastUploadedFileName property: Last uploaded file name. + * + * @return the lastUploadedFileName value. + */ + String lastUploadedFileName(); + + /** + * Gets the lastUploadedFileTime property: Last uploaded file time. + * + * @return the lastUploadedFileTime value. + */ + OffsetDateTime lastUploadedFileTime(); + + /** + * Gets the blockReason property: The reason why restore is in Blocked state. + * + * @return the blockReason value. + */ + String blockReason(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner + * object. + * + * @return the inner object. + */ + ManagedDatabaseRestoreDetailsResultInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicies.java new file mode 100644 index 0000000000000..35220c2c733d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicies.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedDatabaseSecurityAlertPolicies. */ +public interface ManagedDatabaseSecurityAlertPolicies { + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed database's security alert policy. + */ + ManagedDatabaseSecurityAlertPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed database's security alert policy. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's security alert policy. + * + * @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 managed database's security alert policy. + */ + ManagedDatabaseSecurityAlertPolicy getById(String id); + + /** + * Gets a managed database's security alert policy. + * + * @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 managed database's security alert policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedDatabaseSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedDatabaseSecurityAlertPolicy definition. + */ + ManagedDatabaseSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..fdb8651e52209 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ManagedDatabaseSecurityAlertPolicy. */ +public interface ManagedDatabaseSecurityAlertPolicy { + /** + * 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 state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner + * object. + * + * @return the inner object. + */ + ManagedDatabaseSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ManagedDatabaseSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedDatabaseSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedDatabaseSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedDatabaseSecurityAlertPolicy 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.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedDatabaseSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedDatabaseSecurityAlertPolicy create(Context context); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** + * The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ManagedDatabaseSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ManagedDatabaseSecurityAlertPolicy.Update update(); + + /** The template for ManagedDatabaseSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedDatabaseSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedDatabaseSecurityAlertPolicy apply(Context context); + } + /** The ManagedDatabaseSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + Update withState(SecurityAlertPolicyState state); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedDatabaseSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedDatabaseSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.java new file mode 100644 index 0000000000000..6ea329182c30e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the managed database's security alert policies. */ +@Immutable +public final class ManagedDatabaseSecurityAlertPolicyListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedDatabaseSecurityAlertPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java new file mode 100644 index 0000000000000..93f3bbf00bd70 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; + +/** Resource collection API of ManagedDatabaseSensitivityLabels. */ +public interface ManagedDatabaseSensitivityLabels { + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + SensitivityLabel get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + SensitivityLabel createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 sensitivity label. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStatus.java new file mode 100644 index 0000000000000..8405376685e91 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStatus.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedDatabaseStatus. */ +public final class ManagedDatabaseStatus extends ExpandableStringEnum { + /** Static value Online for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus ONLINE = fromString("Online"); + + /** Static value Offline for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Shutdown for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value Creating for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value Restoring for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value Updating for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a ManagedDatabaseStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedDatabaseStatus. + */ + @JsonCreator + public static ManagedDatabaseStatus fromString(String name) { + return fromString(name, ManagedDatabaseStatus.class); + } + + /** @return known ManagedDatabaseStatus values. */ + public static Collection values() { + return values(ManagedDatabaseStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java new file mode 100644 index 0000000000000..a14ddbd24fab2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An managed database update. */ +@JsonFlatten +@Fluent +public class ManagedDatabaseUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDatabaseUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Collation of the managed database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /* + * Status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /* + * Creation date of the database. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "properties.earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestorePoint; + + /* + * Conditional. If createMode is PointInTimeRestore, this value is + * required. Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Geo paired region. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /* + * Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. + * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be + * specified. RestoreExternalBackup: Create a database by restoring from + * external backup files. Collation, StorageContainerUri and + * StorageContainerSasToken must be specified. Recovery: Creates a database + * by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. + * RestoreLongTermRetentionBackup: Create a database by restoring from a + * long term retention backup (longTermRetentionBackupResourceId required). + */ + @JsonProperty(value = "properties.createMode") + private ManagedDatabaseCreateMode createMode; + + /* + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for + * this restore are stored. + */ + @JsonProperty(value = "properties.storageContainerUri") + private String storageContainerUri; + + /* + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The restorable dropped database resource id to restore when creating + * this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "properties.storageContainerSasToken") + private String storageContainerSasToken; + + /* + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /* + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The name of the Long Term Retention backup to be used for restore of + * this managed database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * Whether to auto complete restore of this managed database. + */ + @JsonProperty(value = "properties.autoCompleteRestore") + private Boolean autoCompleteRestore; + + /* + * Last backup file name for restore of this managed database. + */ + @JsonProperty(value = "properties.lastBackupName") + private String lastBackupName; + + /** + * 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 ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the collation property: Collation of the managed database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: Collation of the managed database. + * + * @param collation the collation value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the status property: Status of the database. + * + * @return the status value. + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + public OffsetDateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the createMode property: Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must + * be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, + * StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a + * geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to + * restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @return the createMode value. + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must + * be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, + * StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a + * geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to + * restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @param createMode the createMode value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the storageContainerUri property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @return the storageContainerUri value. + */ + public String storageContainerUri() { + return this.storageContainerUri; + } + + /** + * Set the storageContainerUri property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for this restore are stored. + * + * @param storageContainerUri the storageContainerUri value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + * + * @return the storageContainerSasToken value. + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + * + * @param storageContainerSasToken the storageContainerSasToken value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get the failoverGroupId property: Instance Failover Group resource identifier that this managed database belongs + * to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value. + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @return the autoCompleteRestore value. + */ + public Boolean autoCompleteRestore() { + return this.autoCompleteRestore; + } + + /** + * Set the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @param autoCompleteRestore the autoCompleteRestore value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withAutoCompleteRestore(Boolean autoCompleteRestore) { + this.autoCompleteRestore = autoCompleteRestore; + return this; + } + + /** + * Get the lastBackupName property: Last backup file name for restore of this managed database. + * + * @return the lastBackupName value. + */ + public String lastBackupName() { + return this.lastBackupName; + } + + /** + * Set the lastBackupName property: Last backup file name for restore of this managed database. + * + * @param lastBackupName the lastBackupName value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withLastBackupName(String lastBackupName) { + this.lastBackupName = lastBackupName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..a9f867d4fbc1f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; + +/** Resource collection API of ManagedDatabaseVulnerabilityAssessmentRuleBaselines. */ +public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 database's vulnerability assessment rule baseline. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + DatabaseVulnerabilityAssessmentRuleBaseline createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters); + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @param parameters The requested rule baseline resource. + * @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 database vulnerability assessment rule baseline. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a + * database level rule and master for server level rule). + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..f989fb078f3cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedDatabaseVulnerabilityAssessmentScans. */ +public interface ManagedDatabaseVulnerabilityAssessmentScans { + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 vulnerability assessment scan record of a database. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the scanned database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan 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 database Vulnerability Assessment scan export resource. + */ + Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..c102716076f39 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessments.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; + +/** Resource collection API of ManagedDatabaseVulnerabilityAssessments. */ +public interface ManagedDatabaseVulnerabilityAssessments { + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 database's vulnerability assessment. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + DatabaseVulnerabilityAssessment createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters); + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @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 database vulnerability assessment. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Lists the vulnerability assessments of a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.java new file mode 100644 index 0000000000000..fe0eda9144e99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.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.sql.generated.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 ManagedDatabases. */ +public interface ManagedDatabases { + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database. + */ + ManagedDatabase get(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managed database. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 managedInstanceName, String databaseName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @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 completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context); + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance. + */ + PagedIterable listInaccessibleByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of inaccessible managed databases in a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance. + */ + PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed database. + * + * @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 managed database. + */ + ManagedDatabase getById(String id); + + /** + * Gets a managed database. + * + * @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 managed database. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a managed database. + * + * @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 managed database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedDatabase resource. + * + * @param name resource name. + * @return the first stage of the new ManagedDatabase definition. + */ + ManagedDatabase.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java new file mode 100644 index 0000000000000..dadc1b0bd5f93 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java @@ -0,0 +1,939 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ManagedInstance. */ +public interface ManagedInstance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The Azure Active Directory identity of the managed instance. + * + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * Gets the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + ManagedInstancePropertiesProvisioningState provisioningState(); + + /** + * Gets the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @return the managedInstanceCreateMode value. + */ + ManagedServerCreateMode managedInstanceCreateMode(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the administratorLogin property: Administrator username for the managed instance. Can only be specified when + * the managed instance is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * Gets the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * Gets the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + String subnetId(); + + /** + * Gets the state property: The state of the managed instance. + * + * @return the state value. + */ + String state(); + + /** + * Gets the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive + * of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @return the licenseType value. + */ + ManagedInstanceLicenseType licenseType(); + + /** + * Gets the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value. + */ + Integer vCores(); + + /** + * Gets the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 + * GB allowed only. + * + * @return the storageSizeInGB value. + */ + Integer storageSizeInGB(); + + /** + * Gets the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the dnsZone property: The Dns Zone that the managed instance is in. + * + * @return the dnsZone value. + */ + String dnsZone(); + + /** + * Gets the dnsZonePartner property: The resource id of another managed instance whose DNS zone this managed + * instance will share after creation. + * + * @return the dnsZonePartner value. + */ + String dnsZonePartner(); + + /** + * Gets the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value. + */ + Boolean publicDataEndpointEnabled(); + + /** + * Gets the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @return the sourceManagedInstanceId value. + */ + String sourceManagedInstanceId(); + + /** + * Gets the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + OffsetDateTime restorePointInTime(); + + /** + * Gets the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + ManagedInstanceProxyOverride proxyOverride(); + + /** + * Gets the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows + * keeps details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry values via + * SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by + * executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific + * Standard Time" or "W. Europe Standard Time". + * + * @return the timezoneId value. + */ + String timezoneId(); + + /** + * Gets the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value. + */ + String instancePoolId(); + + /** + * Gets the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections on a managed instance. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + String minimalTlsVersion(); + + /** + * Gets the storageAccountType property: The storage account type used to store backups for this instance. The + * options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + * + * @return the storageAccountType value. + */ + StorageAccountType storageAccountType(); + + /** + * Gets the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * 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.sql.generated.fluent.models.ManagedInstanceInner object. + * + * @return the inner object. + */ + ManagedInstanceInner innerModel(); + + /** The entirety of the ManagedInstance definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ManagedInstance definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstance definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ManagedInstance definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ManagedInstance definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The 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 ManagedInstance definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithSku, + DefinitionStages.WithManagedInstanceCreateMode, + DefinitionStages.WithAdministratorLogin, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithSubnetId, + DefinitionStages.WithLicenseType, + DefinitionStages.WithVCores, + DefinitionStages.WithStorageSizeInGB, + DefinitionStages.WithCollation, + DefinitionStages.WithDnsZonePartner, + DefinitionStages.WithPublicDataEndpointEnabled, + DefinitionStages.WithSourceManagedInstanceId, + DefinitionStages.WithRestorePointInTime, + DefinitionStages.WithProxyOverride, + DefinitionStages.WithTimezoneId, + DefinitionStages.WithInstancePoolId, + DefinitionStages.WithMaintenanceConfigurationId, + DefinitionStages.WithMinimalTlsVersion, + DefinitionStages.WithStorageAccountType, + DefinitionStages.WithZoneRedundant { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstance create(Context context); + } + /** The stage of the ManagedInstance 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 ManagedInstance definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The Azure Active Directory identity of the managed instance.. + * + * @param identity The Azure Active Directory identity of the managed instance. + * @return the next definition stage. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + /** The stage of the ManagedInstance definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, + * BC_Gen5. + * + * @param sku Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the ManagedInstance definition allowing to specify managedInstanceCreateMode. */ + interface WithManagedInstanceCreateMode { + /** + * Specifies the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. + * RestorePointInTime and SourceManagedInstanceId must be specified.. + * + * @param managedInstanceCreateMode Specifies the mode of database creation. + *

Default: Regular instance creation. + *

Restore: Creates an instance by restoring a set of backups to specific point in time. + * RestorePointInTime and SourceManagedInstanceId must be specified. + * @return the next definition stage. + */ + WithCreate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); + } + /** The stage of the ManagedInstance definition allowing to specify administratorLogin. */ + interface WithAdministratorLogin { + /** + * Specifies the administratorLogin property: Administrator username for the managed instance. Can only be + * specified when the managed instance is being created (and is required for creation).. + * + * @param administratorLogin Administrator username for the managed instance. Can only be specified when the + * managed instance is being created (and is required for creation). + * @return the next definition stage. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + /** The stage of the ManagedInstance definition allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for managed + * instance creation).. + * + * @param administratorLoginPassword The administrator login password (required for managed instance + * creation). + * @return the next definition stage. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the ManagedInstance definition allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: Subnet resource ID for the managed instance.. + * + * @param subnetId Subnet resource ID for the managed instance. + * @return the next definition stage. + */ + WithCreate withSubnetId(String subnetId); + } + /** The stage of the ManagedInstance definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular + * price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL + * licenses).. + * + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a + * new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * @return the next definition stage. + */ + WithCreate withLicenseType(ManagedInstanceLicenseType licenseType); + } + /** The stage of the ManagedInstance definition allowing to specify vCores. */ + interface WithVCores { + /** + * Specifies the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.. + * + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * @return the next definition stage. + */ + WithCreate withVCores(Integer vCores); + } + /** The stage of the ManagedInstance definition allowing to specify storageSizeInGB. */ + interface WithStorageSizeInGB { + /** + * Specifies the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. + * Increments of 32 GB allowed only.. + * + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * @return the next definition stage. + */ + WithCreate withStorageSizeInGB(Integer storageSizeInGB); + } + /** The stage of the ManagedInstance definition allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: Collation of the managed instance.. + * + * @param collation Collation of the managed instance. + * @return the next definition stage. + */ + WithCreate withCollation(String collation); + } + /** The stage of the ManagedInstance definition allowing to specify dnsZonePartner. */ + interface WithDnsZonePartner { + /** + * Specifies the dnsZonePartner property: The resource id of another managed instance whose DNS zone this + * managed instance will share after creation.. + * + * @param dnsZonePartner The resource id of another managed instance whose DNS zone this managed instance + * will share after creation. + * @return the next definition stage. + */ + WithCreate withDnsZonePartner(String dnsZonePartner); + } + /** The stage of the ManagedInstance definition allowing to specify publicDataEndpointEnabled. */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled.. + * + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled. + * @return the next definition stage. + */ + WithCreate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + /** The stage of the ManagedInstance definition allowing to specify sourceManagedInstanceId. */ + interface WithSourceManagedInstanceId { + /** + * Specifies the sourceManagedInstanceId property: The resource identifier of the source managed instance + * associated with create operation of this instance.. + * + * @param sourceManagedInstanceId The resource identifier of the source managed instance associated with + * create operation of this instance. + * @return the next definition stage. + */ + WithCreate withSourceManagedInstanceId(String sourceManagedInstanceId); + } + /** The stage of the ManagedInstance definition allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database.. + * + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will + * be restored to create the new database. + * @return the next definition stage. + */ + WithCreate withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the ManagedInstance definition allowing to specify proxyOverride. */ + interface WithProxyOverride { + /** + * Specifies the proxyOverride property: Connection type used for connecting to the instance.. + * + * @param proxyOverride Connection type used for connecting to the instance. + * @return the next definition stage. + */ + WithCreate withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + /** The stage of the ManagedInstance definition allowing to specify timezoneId. */ + interface WithTimezoneId { + /** + * Specifies the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry + * values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can + * also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of + * valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".. + * + * @param timezoneId Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry + * values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can + * also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example + * of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * @return the next definition stage. + */ + WithCreate withTimezoneId(String timezoneId); + } + /** The stage of the ManagedInstance definition allowing to specify instancePoolId. */ + interface WithInstancePoolId { + /** + * Specifies the instancePoolId property: The Id of the instance pool this managed server belongs to.. + * + * @param instancePoolId The Id of the instance pool this managed server belongs to. + * @return the next definition stage. + */ + WithCreate withInstancePoolId(String instancePoolId); + } + /** The stage of the ManagedInstance definition allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to + * this managed instance.. + * + * @param maintenanceConfigurationId Specifies maintenance configuration id to apply to this managed + * instance. + * @return the next definition stage. + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the ManagedInstance definition allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', + * '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + WithCreate withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the ManagedInstance definition allowing to specify storageAccountType. */ + interface WithStorageAccountType { + /** + * Specifies the storageAccountType property: The storage account type used to store backups for this + * instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS + * (GeoRedundantStorage). + * + * @param storageAccountType The storage account type used to store backups for this instance. The options + * are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + * @return the next definition stage. + */ + WithCreate withStorageAccountType(StorageAccountType storageAccountType); + } + /** The stage of the ManagedInstance definition allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not the multi-az is enabled.. + * + * @param zoneRedundant Whether or not the multi-az is enabled. + * @return the next definition stage. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + } + /** + * Begins update for the ManagedInstance resource. + * + * @return the stage of resource update. + */ + ManagedInstance.Update update(); + + /** The template for ManagedInstance update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithIdentity, + UpdateStages.WithManagedInstanceCreateMode, + UpdateStages.WithAdministratorLogin, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithSubnetId, + UpdateStages.WithLicenseType, + UpdateStages.WithVCores, + UpdateStages.WithStorageSizeInGB, + UpdateStages.WithCollation, + UpdateStages.WithDnsZonePartner, + UpdateStages.WithPublicDataEndpointEnabled, + UpdateStages.WithSourceManagedInstanceId, + UpdateStages.WithRestorePointInTime, + UpdateStages.WithProxyOverride, + UpdateStages.WithTimezoneId, + UpdateStages.WithInstancePoolId, + UpdateStages.WithMaintenanceConfigurationId, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithStorageAccountType, + UpdateStages.WithZoneRedundant { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstance apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstance apply(Context context); + } + /** The ManagedInstance update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstance update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ManagedInstance update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Managed instance sku. + * + * @param sku Managed instance sku. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the ManagedInstance update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed instance identity. + * + * @param identity Managed instance identity. + * @return the next definition stage. + */ + Update withIdentity(ResourceIdentity identity); + } + /** The stage of the ManagedInstance update allowing to specify managedInstanceCreateMode. */ + interface WithManagedInstanceCreateMode { + /** + * Specifies the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. + * RestorePointInTime and SourceManagedInstanceId must be specified.. + * + * @param managedInstanceCreateMode Specifies the mode of database creation. + *

Default: Regular instance creation. + *

Restore: Creates an instance by restoring a set of backups to specific point in time. + * RestorePointInTime and SourceManagedInstanceId must be specified. + * @return the next definition stage. + */ + Update withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); + } + /** The stage of the ManagedInstance update allowing to specify administratorLogin. */ + interface WithAdministratorLogin { + /** + * Specifies the administratorLogin property: Administrator username for the managed instance. Can only be + * specified when the managed instance is being created (and is required for creation).. + * + * @param administratorLogin Administrator username for the managed instance. Can only be specified when the + * managed instance is being created (and is required for creation). + * @return the next definition stage. + */ + Update withAdministratorLogin(String administratorLogin); + } + /** The stage of the ManagedInstance update allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for managed + * instance creation).. + * + * @param administratorLoginPassword The administrator login password (required for managed instance + * creation). + * @return the next definition stage. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the ManagedInstance update allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: Subnet resource ID for the managed instance.. + * + * @param subnetId Subnet resource ID for the managed instance. + * @return the next definition stage. + */ + Update withSubnetId(String subnetId); + } + /** The stage of the ManagedInstance update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular + * price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL + * licenses).. + * + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a + * new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * @return the next definition stage. + */ + Update withLicenseType(ManagedInstanceLicenseType licenseType); + } + /** The stage of the ManagedInstance update allowing to specify vCores. */ + interface WithVCores { + /** + * Specifies the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.. + * + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * @return the next definition stage. + */ + Update withVCores(Integer vCores); + } + /** The stage of the ManagedInstance update allowing to specify storageSizeInGB. */ + interface WithStorageSizeInGB { + /** + * Specifies the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. + * Increments of 32 GB allowed only.. + * + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * @return the next definition stage. + */ + Update withStorageSizeInGB(Integer storageSizeInGB); + } + /** The stage of the ManagedInstance update allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: Collation of the managed instance.. + * + * @param collation Collation of the managed instance. + * @return the next definition stage. + */ + Update withCollation(String collation); + } + /** The stage of the ManagedInstance update allowing to specify dnsZonePartner. */ + interface WithDnsZonePartner { + /** + * Specifies the dnsZonePartner property: The resource id of another managed instance whose DNS zone this + * managed instance will share after creation.. + * + * @param dnsZonePartner The resource id of another managed instance whose DNS zone this managed instance + * will share after creation. + * @return the next definition stage. + */ + Update withDnsZonePartner(String dnsZonePartner); + } + /** The stage of the ManagedInstance update allowing to specify publicDataEndpointEnabled. */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled.. + * + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled. + * @return the next definition stage. + */ + Update withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + /** The stage of the ManagedInstance update allowing to specify sourceManagedInstanceId. */ + interface WithSourceManagedInstanceId { + /** + * Specifies the sourceManagedInstanceId property: The resource identifier of the source managed instance + * associated with create operation of this instance.. + * + * @param sourceManagedInstanceId The resource identifier of the source managed instance associated with + * create operation of this instance. + * @return the next definition stage. + */ + Update withSourceManagedInstanceId(String sourceManagedInstanceId); + } + /** The stage of the ManagedInstance update allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database.. + * + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will + * be restored to create the new database. + * @return the next definition stage. + */ + Update withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the ManagedInstance update allowing to specify proxyOverride. */ + interface WithProxyOverride { + /** + * Specifies the proxyOverride property: Connection type used for connecting to the instance.. + * + * @param proxyOverride Connection type used for connecting to the instance. + * @return the next definition stage. + */ + Update withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + /** The stage of the ManagedInstance update allowing to specify timezoneId. */ + interface WithTimezoneId { + /** + * Specifies the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry + * values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can + * also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of + * valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".. + * + * @param timezoneId Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry + * values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can + * also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example + * of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * @return the next definition stage. + */ + Update withTimezoneId(String timezoneId); + } + /** The stage of the ManagedInstance update allowing to specify instancePoolId. */ + interface WithInstancePoolId { + /** + * Specifies the instancePoolId property: The Id of the instance pool this managed server belongs to.. + * + * @param instancePoolId The Id of the instance pool this managed server belongs to. + * @return the next definition stage. + */ + Update withInstancePoolId(String instancePoolId); + } + /** The stage of the ManagedInstance update allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to + * this managed instance.. + * + * @param maintenanceConfigurationId Specifies maintenance configuration id to apply to this managed + * instance. + * @return the next definition stage. + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the ManagedInstance update allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', + * '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + Update withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the ManagedInstance update allowing to specify storageAccountType. */ + interface WithStorageAccountType { + /** + * Specifies the storageAccountType property: The storage account type used to store backups for this + * instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS + * (GeoRedundantStorage). + * + * @param storageAccountType The storage account type used to store backups for this instance. The options + * are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + * @return the next definition stage. + */ + Update withStorageAccountType(StorageAccountType storageAccountType); + } + /** The stage of the ManagedInstance update allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not the multi-az is enabled.. + * + * @param zoneRedundant Whether or not the multi-az is enabled. + * @return the next definition stage. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstance refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrator.java new file mode 100644 index 0000000000000..2468503ff070d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrator.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import java.util.UUID; + +/** An immutable client-side representation of ManagedInstanceAdministrator. */ +public interface ManagedInstanceAdministrator { + /** + * 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 administratorType property: Type of the managed instance administrator. + * + * @return the administratorType value. + */ + ManagedInstanceAdministratorType administratorType(); + + /** + * Gets the login property: Login name of the managed instance administrator. + * + * @return the login value. + */ + String login(); + + /** + * Gets the sid property: SID (object ID) of the managed instance administrator. + * + * @return the sid value. + */ + UUID sid(); + + /** + * Gets the tenantId property: Tenant ID of the managed instance administrator. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner object. + * + * @return the inner object. + */ + ManagedInstanceAdministratorInner innerModel(); + + /** The entirety of the ManagedInstanceAdministrator definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceAdministrator definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceAdministrator definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceAdministrator 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.WithAdministratorType, + DefinitionStages.WithLogin, + DefinitionStages.WithSid, + DefinitionStages.WithTenantId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceAdministrator create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceAdministrator create(Context context); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the managed instance administrator.. + * + * @param administratorType Type of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withAdministratorType(ManagedInstanceAdministratorType administratorType); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the managed instance administrator.. + * + * @param login Login name of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withLogin(String login); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the managed instance administrator.. + * + * @param sid SID (object ID) of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withSid(UUID sid); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the managed instance administrator.. + * + * @param tenantId Tenant ID of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withTenantId(UUID tenantId); + } + } + /** + * Begins update for the ManagedInstanceAdministrator resource. + * + * @return the stage of resource update. + */ + ManagedInstanceAdministrator.Update update(); + + /** The template for ManagedInstanceAdministrator update. */ + interface Update + extends UpdateStages.WithAdministratorType, + UpdateStages.WithLogin, + UpdateStages.WithSid, + UpdateStages.WithTenantId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceAdministrator apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceAdministrator apply(Context context); + } + /** The ManagedInstanceAdministrator update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceAdministrator update allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the managed instance administrator.. + * + * @param administratorType Type of the managed instance administrator. + * @return the next definition stage. + */ + Update withAdministratorType(ManagedInstanceAdministratorType administratorType); + } + /** The stage of the ManagedInstanceAdministrator update allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the managed instance administrator.. + * + * @param login Login name of the managed instance administrator. + * @return the next definition stage. + */ + Update withLogin(String login); + } + /** The stage of the ManagedInstanceAdministrator update allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the managed instance administrator.. + * + * @param sid SID (object ID) of the managed instance administrator. + * @return the next definition stage. + */ + Update withSid(UUID sid); + } + /** The stage of the ManagedInstanceAdministrator update allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the managed instance administrator.. + * + * @param tenantId Tenant ID of the managed instance administrator. + * @return the next definition stage. + */ + Update withTenantId(UUID tenantId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceAdministrator refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceAdministrator refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.java new file mode 100644 index 0000000000000..d485ca2321a16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance administrators. */ +@Immutable +public final class ManagedInstanceAdministratorListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceAdministratorListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorType.java new file mode 100644 index 0000000000000..f576f477df5b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedInstanceAdministratorType. */ +public final class ManagedInstanceAdministratorType extends ExpandableStringEnum { + /** Static value ActiveDirectory for ManagedInstanceAdministratorType. */ + public static final ManagedInstanceAdministratorType ACTIVE_DIRECTORY = fromString("ActiveDirectory"); + + /** + * Creates or finds a ManagedInstanceAdministratorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstanceAdministratorType. + */ + @JsonCreator + public static ManagedInstanceAdministratorType fromString(String name) { + return fromString(name, ManagedInstanceAdministratorType.class); + } + + /** @return known ManagedInstanceAdministratorType values. */ + public static Collection values() { + return values(ManagedInstanceAdministratorType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.java new file mode 100644 index 0000000000000..11cf7262b1b24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstanceAdministrators. */ +public interface ManagedInstanceAdministrators { + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance administrators. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrator. + */ + ManagedInstanceAdministrator get(String resourceGroupName, String managedInstanceName); + + /** + * Gets a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance administrator. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managedInstanceName); + + /** + * Deletes a managed instance administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed instance administrator. + * + * @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 managed instance administrator. + */ + ManagedInstanceAdministrator getById(String id); + + /** + * Gets a managed instance administrator. + * + * @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 managed instance administrator. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a managed instance administrator. + * + * @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 managed instance administrator. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceAdministrator resource. + * + * @return the first stage of the new ManagedInstanceAdministrator definition. + */ + ManagedInstanceAdministrator.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.java new file mode 100644 index 0000000000000..8d26fb5c4f8cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory only authentications. */ +@Immutable +public final class ManagedInstanceAzureADOnlyAuthListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceAzureADOnlyAuthListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentication.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentication.java new file mode 100644 index 0000000000000..42f021cb906e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentication.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; + +/** An immutable client-side representation of ManagedInstanceAzureADOnlyAuthentication. */ +public interface ManagedInstanceAzureADOnlyAuthentication { + /** + * 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 azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + Boolean azureADOnlyAuthentication(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner object. + * + * @return the inner object. + */ + ManagedInstanceAzureADOnlyAuthenticationInner innerModel(); + + /** The entirety of the ManagedInstanceAzureADOnlyAuthentication definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceAzureADOnlyAuthentication definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceAzureADOnlyAuthentication definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceAzureADOnlyAuthentication definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceAzureADOnlyAuthentication 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.WithAzureADOnlyAuthentication { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceAzureADOnlyAuthentication create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceAzureADOnlyAuthentication create(Context context); + } + /** + * The stage of the ManagedInstanceAzureADOnlyAuthentication definition allowing to specify + * azureADOnlyAuthentication. + */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + WithCreate withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication); + } + } + /** + * Begins update for the ManagedInstanceAzureADOnlyAuthentication resource. + * + * @return the stage of resource update. + */ + ManagedInstanceAzureADOnlyAuthentication.Update update(); + + /** The template for ManagedInstanceAzureADOnlyAuthentication update. */ + interface Update extends UpdateStages.WithAzureADOnlyAuthentication { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceAzureADOnlyAuthentication apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceAzureADOnlyAuthentication apply(Context context); + } + /** The ManagedInstanceAzureADOnlyAuthentication update stages. */ + interface UpdateStages { + /** + * The stage of the ManagedInstanceAzureADOnlyAuthentication update allowing to specify + * azureADOnlyAuthentication. + */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + Update withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceAzureADOnlyAuthentication refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceAzureADOnlyAuthentication refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.java new file mode 100644 index 0000000000000..d171c7af6908b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstanceAzureADOnlyAuthentications. */ +public interface ManagedInstanceAzureADOnlyAuthentications { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + ManagedInstanceAzureADOnlyAuthentication get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @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 managedInstanceName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @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 specific Azure Active Directory only authentication property. + */ + ManagedInstanceAzureADOnlyAuthentication getById(String id); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @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 specific Azure Active Directory only authentication property. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceAzureADOnlyAuthentication resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceAzureADOnlyAuthentication definition. + */ + ManagedInstanceAzureADOnlyAuthentication.DefinitionStages.Blank define(AuthenticationName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.java new file mode 100644 index 0000000000000..f62a6560fe6fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The managed server capability. */ +@Fluent +public final class ManagedInstanceEditionCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceEditionCapability.class); + + /* + * The managed server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The supported families. + */ + @JsonProperty(value = "supportedFamilies", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFamilies; + + /* + * The list of supported storage capabilities for this edition + */ + @JsonProperty(value = "supportedStorageCapabilities", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageCapabilities; + + /* + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The managed server version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedFamilies property: The supported families. + * + * @return the supportedFamilies value. + */ + public List supportedFamilies() { + return this.supportedFamilies; + } + + /** + * Get the supportedStorageCapabilities property: The list of supported storage capabilities for this edition. + * + * @return the supportedStorageCapabilities value. + */ + public List supportedStorageCapabilities() { + return this.supportedStorageCapabilities; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ManagedInstanceEditionCapability object itself. + */ + public ManagedInstanceEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedFamilies() != null) { + supportedFamilies().forEach(e -> e.validate()); + } + if (supportedStorageCapabilities() != null) { + supportedStorageCapabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.java new file mode 100644 index 0000000000000..50aaa402c4788 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; + +/** An immutable client-side representation of ManagedInstanceEncryptionProtector. */ +public interface ManagedInstanceEncryptionProtector { + /** + * 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 kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the serverKeyName property: The name of the managed instance key. + * + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * Gets the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the server key. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner + * object. + * + * @return the inner object. + */ + ManagedInstanceEncryptionProtectorInner innerModel(); + + /** The entirety of the ManagedInstanceEncryptionProtector definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceEncryptionProtector definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceEncryptionProtector definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceEncryptionProtector 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.WithServerKeyName, DefinitionStages.WithServerKeyType { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceEncryptionProtector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceEncryptionProtector create(Context context); + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the managed instance key.. + * + * @param serverKeyName The name of the managed instance key. + * @return the next definition stage. + */ + WithCreate withServerKeyName(String serverKeyName); + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + } + /** + * Begins update for the ManagedInstanceEncryptionProtector resource. + * + * @return the stage of resource update. + */ + ManagedInstanceEncryptionProtector.Update update(); + + /** The template for ManagedInstanceEncryptionProtector update. */ + interface Update extends UpdateStages.WithServerKeyName, UpdateStages.WithServerKeyType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceEncryptionProtector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceEncryptionProtector apply(Context context); + } + /** The ManagedInstanceEncryptionProtector update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceEncryptionProtector update allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the managed instance key.. + * + * @param serverKeyName The name of the managed instance key. + * @return the next definition stage. + */ + Update withServerKeyName(String serverKeyName); + } + /** The stage of the ManagedInstanceEncryptionProtector update allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + Update withServerKeyType(ServerKeyType serverKeyType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceEncryptionProtector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceEncryptionProtector refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.java new file mode 100644 index 0000000000000..46aa1b1460eb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance encryption protectors. */ +@Immutable +public final class ManagedInstanceEncryptionProtectorListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceEncryptionProtectorListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectors.java new file mode 100644 index 0000000000000..a7eac5636c0ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectors.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstanceEncryptionProtectors. */ +public interface ManagedInstanceEncryptionProtectors { + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be 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. + */ + void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 managed instance encryption protector. + */ + ManagedInstanceEncryptionProtector get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param encryptionProtectorName The name of the encryption protector to be retrieved. + * @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 managed instance encryption protector. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * Gets a managed instance encryption protector. + * + * @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 managed instance encryption protector. + */ + ManagedInstanceEncryptionProtector getById(String id); + + /** + * Gets a managed instance encryption protector. + * + * @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 managed instance encryption protector. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceEncryptionProtector resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceEncryptionProtector definition. + */ + ManagedInstanceEncryptionProtector.DefinitionStages.Blank define(EncryptionProtectorName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.java new file mode 100644 index 0000000000000..d260cde90d399 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The managed server family capability. */ +@Fluent +public final class ManagedInstanceFamilyCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceFamilyCapability.class); + + /* + * Family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * SKU name. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /* + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /* + * List of supported virtual cores values. + */ + @JsonProperty(value = "supportedVcoresValues", access = JsonProperty.Access.WRITE_ONLY) + private List supportedVcoresValues; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: Family name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the sku property: SKU name. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the supportedVcoresValues property: List of supported virtual cores values. + * + * @return the supportedVcoresValues value. + */ + public List supportedVcoresValues() { + return this.supportedVcoresValues; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ManagedInstanceFamilyCapability object itself. + */ + public ManagedInstanceFamilyCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (supportedVcoresValues() != null) { + supportedVcoresValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.java new file mode 100644 index 0000000000000..09b6dbc5cdf30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedInstanceKey. */ +public interface ManagedInstanceKey { + /** + * 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 kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner object. + * + * @return the inner object. + */ + ManagedInstanceKeyInner innerModel(); + + /** The entirety of the ManagedInstanceKey definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceKey definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceKey definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceKey definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceKey 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.WithServerKeyType, DefinitionStages.WithUri { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceKey create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceKey create(Context context); + } + /** The stage of the ManagedInstanceKey definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'.. + * + * @param serverKeyType The key type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ManagedInstanceKey definition allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is + * required.. + * + * @param uri The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + } + /** + * Begins update for the ManagedInstanceKey resource. + * + * @return the stage of resource update. + */ + ManagedInstanceKey.Update update(); + + /** The template for ManagedInstanceKey update. */ + interface Update extends UpdateStages.WithServerKeyType, UpdateStages.WithUri { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceKey apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceKey apply(Context context); + } + /** The ManagedInstanceKey update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceKey update allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'.. + * + * @param serverKeyType The key type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + Update withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ManagedInstanceKey update allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is + * required.. + * + * @param uri The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * @return the next definition stage. + */ + Update withUri(String uri); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceKey refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceKey refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.java new file mode 100644 index 0000000000000..275ae5cd2a872 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance keys. */ +@Immutable +public final class ManagedInstanceKeyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceKeyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeys.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeys.java new file mode 100644 index 0000000000000..365007b913b32 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeys.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstanceKeys. */ +public interface ManagedInstanceKeys { + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context); + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @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 managed instance key. + */ + ManagedInstanceKey get(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be retrieved. + * @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 managed instance key. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @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 managedInstanceName, String keyName); + + /** + * Deletes the managed instance key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * Gets a managed instance key. + * + * @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 managed instance key. + */ + ManagedInstanceKey getById(String id); + + /** + * Gets a managed instance key. + * + * @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 managed instance key. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the managed instance key with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the managed instance key with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceKey resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceKey definition. + */ + ManagedInstanceKey.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLicenseType.java new file mode 100644 index 0000000000000..ce466f813eea8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLicenseType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedInstanceLicenseType. */ +public final class ManagedInstanceLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ManagedInstanceLicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstanceLicenseType. + */ + @JsonCreator + public static ManagedInstanceLicenseType fromString(String name) { + return fromString(name, ManagedInstanceLicenseType.class); + } + + /** @return known ManagedInstanceLicenseType values. */ + public static Collection values() { + return values(ManagedInstanceLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.java new file mode 100644 index 0000000000000..2d223ae8a90a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instances. */ +@Immutable +public final class ManagedInstanceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.java new file mode 100644 index 0000000000000..c3e9c93807f26 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedInstanceLongTermRetentionBackup. */ +public interface ManagedInstanceLongTermRetentionBackup { + /** + * 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 managedInstanceName property: The managed instance that the backup database belongs to. + * + * @return the managedInstanceName value. + */ + String managedInstanceName(); + + /** + * Gets the managedInstanceCreateTime property: The create time of the instance. + * + * @return the managedInstanceCreateTime value. + */ + OffsetDateTime managedInstanceCreateTime(); + + /** + * Gets the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + OffsetDateTime databaseDeletionTime(); + + /** + * Gets the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + OffsetDateTime backupTime(); + + /** + * Gets the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + OffsetDateTime backupExpirationTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner + * object. + * + * @return the inner object. + */ + ManagedInstanceLongTermRetentionBackupInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.java new file mode 100644 index 0000000000000..5158b5c83ece0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups for managed database(s). */ +@Immutable +public final class ManagedInstanceLongTermRetentionBackupListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceLongTermRetentionBackupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicies.java new file mode 100644 index 0000000000000..cf337ac9797d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicies.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstanceLongTermRetentionPolicies. */ +public interface ManagedInstanceLongTermRetentionPolicies { + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 managed database's long term retention policy. + */ + ManagedInstanceLongTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName); + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @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 managed database's long term retention policy. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @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 database's long term retention policy. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's long term retention policy. + * + * @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 managed database's long term retention policy. + */ + ManagedInstanceLongTermRetentionPolicy getById(String id); + + /** + * Gets a managed database's long term retention policy. + * + * @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 managed database's long term retention policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceLongTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceLongTermRetentionPolicy definition. + */ + ManagedInstanceLongTermRetentionPolicy.DefinitionStages.Blank define( + ManagedInstanceLongTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicy.java new file mode 100644 index 0000000000000..eb657f9bffe96 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicy.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; + +/** An immutable client-side representation of ManagedInstanceLongTermRetentionPolicy. */ +public interface ManagedInstanceLongTermRetentionPolicy { + /** + * 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 weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + String weeklyRetention(); + + /** + * Gets the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + String monthlyRetention(); + + /** + * Gets the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + String yearlyRetention(); + + /** + * Gets the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + Integer weekOfYear(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner + * object. + * + * @return the inner object. + */ + ManagedInstanceLongTermRetentionPolicyInner innerModel(); + + /** The entirety of the ManagedInstanceLongTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceLongTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceLongTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedInstanceLongTermRetentionPolicy 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.WithWeeklyRetention, + DefinitionStages.WithMonthlyRetention, + DefinitionStages.WithYearlyRetention, + DefinitionStages.WithWeekOfYear { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceLongTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceLongTermRetentionPolicy create(Context context); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeeklyRetention(String weeklyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withMonthlyRetention(String monthlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withYearlyRetention(String yearlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeekOfYear(Integer weekOfYear); + } + } + /** + * Begins update for the ManagedInstanceLongTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + ManagedInstanceLongTermRetentionPolicy.Update update(); + + /** The template for ManagedInstanceLongTermRetentionPolicy update. */ + interface Update + extends UpdateStages.WithWeeklyRetention, + UpdateStages.WithMonthlyRetention, + UpdateStages.WithYearlyRetention, + UpdateStages.WithWeekOfYear { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceLongTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceLongTermRetentionPolicy apply(Context context); + } + /** The ManagedInstanceLongTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeeklyRetention(String weeklyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withMonthlyRetention(String monthlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withYearlyRetention(String yearlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeekOfYear(Integer weekOfYear); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceLongTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceLongTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..a9ec1e55ad4a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention policies. */ +@Immutable +public final class ManagedInstanceLongTermRetentionPolicyListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceLongTermRetentionPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyName.java new file mode 100644 index 0000000000000..ddde6f175da80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedInstanceLongTermRetentionPolicyName. */ +public final class ManagedInstanceLongTermRetentionPolicyName + extends ExpandableStringEnum { + /** Static value default for ManagedInstanceLongTermRetentionPolicyName. */ + public static final ManagedInstanceLongTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ManagedInstanceLongTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstanceLongTermRetentionPolicyName. + */ + @JsonCreator + public static ManagedInstanceLongTermRetentionPolicyName fromString(String name) { + return fromString(name, ManagedInstanceLongTermRetentionPolicyName.class); + } + + /** @return known ManagedInstanceLongTermRetentionPolicyName values. */ + public static Collection values() { + return values(ManagedInstanceLongTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.java new file mode 100644 index 0000000000000..798f55c2589ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 maintenance configuration capability. */ +@Fluent +public final class ManagedInstanceMaintenanceConfigurationCapability { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceMaintenanceConfigurationCapability.class); + + /* + * Maintenance configuration name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: Maintenance configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ManagedInstanceMaintenanceConfigurationCapability object itself. + */ + public ManagedInstanceMaintenanceConfigurationCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperation.java new file mode 100644 index 0000000000000..9a8bdcaafd2e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperation.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedInstanceOperation. */ +public interface ManagedInstanceOperation { + /** + * 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 managedInstanceName property: The name of the managed instance the operation is being performed on. + * + * @return the managedInstanceName value. + */ + String managedInstanceName(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + ManagementOperationState state(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + OffsetDateTime estimatedCompletionTime(); + + /** + * Gets the description property: The operation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the operationParameters property: The operation parameters. + * + * @return the operationParameters value. + */ + ManagedInstanceOperationParametersPair operationParameters(); + + /** + * Gets the operationSteps property: The operation steps. + * + * @return the operationSteps value. + */ + ManagedInstanceOperationSteps operationSteps(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner object. + * + * @return the inner object. + */ + ManagedInstanceOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.java new file mode 100644 index 0000000000000..db7b5068dd87a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list managed instance operations request. */ +@Immutable +public final class ManagedInstanceOperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceOperationListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.java new file mode 100644 index 0000000000000..f05a450d5b693 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationParametersPair { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceOperationParametersPair.class); + + /* + * The current parameters. + */ + @JsonProperty(value = "currentParameters", access = JsonProperty.Access.WRITE_ONLY) + private UpsertManagedServerOperationParameters currentParameters; + + /* + * The requested parameters. + */ + @JsonProperty(value = "requestedParameters", access = JsonProperty.Access.WRITE_ONLY) + private UpsertManagedServerOperationParameters requestedParameters; + + /** + * Get the currentParameters property: The current parameters. + * + * @return the currentParameters value. + */ + public UpsertManagedServerOperationParameters currentParameters() { + return this.currentParameters; + } + + /** + * Get the requestedParameters property: The requested parameters. + * + * @return the requestedParameters value. + */ + public UpsertManagedServerOperationParameters requestedParameters() { + return this.requestedParameters; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentParameters() != null) { + currentParameters().validate(); + } + if (requestedParameters() != null) { + requestedParameters().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.java new file mode 100644 index 0000000000000..6722f84809bb4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.util.List; + +/** The steps of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationSteps { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceOperationSteps.class); + + /* + * The total number of operation steps. + */ + @JsonProperty(value = "totalSteps", access = JsonProperty.Access.WRITE_ONLY) + private String totalSteps; + + /* + * The number of current operation steps. + */ + @JsonProperty(value = "currentStep", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentStep; + + /* + * The operation steps list. + */ + @JsonProperty(value = "stepsList", access = JsonProperty.Access.WRITE_ONLY) + private List stepsList; + + /** + * Get the totalSteps property: The total number of operation steps. + * + * @return the totalSteps value. + */ + public String totalSteps() { + return this.totalSteps; + } + + /** + * Get the currentStep property: The number of current operation steps. + * + * @return the currentStep value. + */ + public Integer currentStep() { + return this.currentStep; + } + + /** + * Get the stepsList property: The operation steps list. + * + * @return the stepsList value. + */ + public List stepsList() { + return this.stepsList; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (stepsList() != null) { + stepsList().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperations.java new file mode 100644 index 0000000000000..ebbfa8b549369 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperations.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** Resource collection API of ManagedInstanceOperations. */ +public interface ManagedInstanceOperations { + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(String resourceGroupName, String managedInstanceName, UUID operationId); + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance. + */ + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance. + */ + ManagedInstanceOperation get(String resourceGroupName, String managedInstanceName, UUID operationId); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.java new file mode 100644 index 0000000000000..8ace6ee323068 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Pairs of Managed Instances in the failover group. */ +@Fluent +public final class ManagedInstancePairInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstancePairInfo.class); + + /* + * Id of Primary Managed Instance in pair. + */ + @JsonProperty(value = "primaryManagedInstanceId") + private String primaryManagedInstanceId; + + /* + * Id of Partner Managed Instance in pair. + */ + @JsonProperty(value = "partnerManagedInstanceId") + private String partnerManagedInstanceId; + + /** + * Get the primaryManagedInstanceId property: Id of Primary Managed Instance in pair. + * + * @return the primaryManagedInstanceId value. + */ + public String primaryManagedInstanceId() { + return this.primaryManagedInstanceId; + } + + /** + * Set the primaryManagedInstanceId property: Id of Primary Managed Instance in pair. + * + * @param primaryManagedInstanceId the primaryManagedInstanceId value to set. + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPrimaryManagedInstanceId(String primaryManagedInstanceId) { + this.primaryManagedInstanceId = primaryManagedInstanceId; + return this; + } + + /** + * Get the partnerManagedInstanceId property: Id of Partner Managed Instance in pair. + * + * @return the partnerManagedInstanceId value. + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set the partnerManagedInstanceId property: Id of Partner Managed Instance in pair. + * + * @param partnerManagedInstanceId the partnerManagedInstanceId value to set. + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPartnerManagedInstanceId(String partnerManagedInstanceId) { + this.partnerManagedInstanceId = partnerManagedInstanceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.java new file mode 100644 index 0000000000000..cbc6ee2694e15 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** A private endpoint connection under a managed instance. */ +@Immutable +public final class ManagedInstancePecProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstancePecProperty.class); + + /* + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Private endpoint connection properties + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstancePrivateEndpointConnectionProperties properties; + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the properties property: Private endpoint connection properties. + * + * @return the properties value. + */ + public ManagedInstancePrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..c19eba54f8824 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionProperties.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class ManagedInstancePrivateEndpointConnectionProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstancePrivateEndpointConnectionProperties.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private ManagedInstancePrivateEndpointProperty privateEndpoint; + + /* + * Connection State of the Private Endpoint Connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the Private Endpoint Connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public ManagedInstancePrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the ManagedInstancePrivateEndpointConnectionProperties object itself. + */ + public ManagedInstancePrivateEndpointConnectionProperties withPrivateEndpoint( + ManagedInstancePrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the ManagedInstancePrivateEndpointConnectionProperties object itself. + */ + public ManagedInstancePrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the Private Endpoint Connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.java new file mode 100644 index 0000000000000..975f39e1f90d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstancePrivateEndpointProperty model. */ +@Fluent +public final class ManagedInstancePrivateEndpointProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstancePrivateEndpointProperty.class); + + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the ManagedInstancePrivateEndpointProperty object itself. + */ + public ManagedInstancePrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..491ba45312b38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstancePrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class ManagedInstancePrivateLinkServiceConnectionStateProperty { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(ManagedInstancePrivateLinkServiceConnectionStateProperty.class); + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the ManagedInstancePrivateLinkServiceConnectionStateProperty object itself. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the ManagedInstancePrivateLinkServiceConnectionStateProperty object itself. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The private link service connection description. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model" + + " ManagedInstancePrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model" + + " ManagedInstancePrivateLinkServiceConnectionStateProperty")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.java new file mode 100644 index 0000000000000..3b9c4d66fcbb0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedInstancePropertiesProvisioningState. */ +public final class ManagedInstancePropertiesProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState DELETING = fromString("Deleting"); + + /** Static value Updating for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState UPDATING = fromString("Updating"); + + /** Static value Unknown for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState UNKNOWN = fromString("Unknown"); + + /** Static value Succeeded for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a ManagedInstancePropertiesProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstancePropertiesProvisioningState. + */ + @JsonCreator + public static ManagedInstancePropertiesProvisioningState fromString(String name) { + return fromString(name, ManagedInstancePropertiesProvisioningState.class); + } + + /** @return known ManagedInstancePropertiesProvisioningState values. */ + public static Collection values() { + return values(ManagedInstancePropertiesProvisioningState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceProxyOverride.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceProxyOverride.java new file mode 100644 index 0000000000000..68d0cde6737c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceProxyOverride.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedInstanceProxyOverride. */ +public final class ManagedInstanceProxyOverride extends ExpandableStringEnum { + /** Static value Proxy for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride PROXY = fromString("Proxy"); + + /** Static value Redirect for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride REDIRECT = fromString("Redirect"); + + /** Static value Default for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride DEFAULT = fromString("Default"); + + /** + * Creates or finds a ManagedInstanceProxyOverride from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstanceProxyOverride. + */ + @JsonCreator + public static ManagedInstanceProxyOverride fromString(String name) { + return fromString(name, ManagedInstanceProxyOverride.class); + } + + /** @return known ManagedInstanceProxyOverride values. */ + public static Collection values() { + return values(ManagedInstanceProxyOverride.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceTdeCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceTdeCertificates.java new file mode 100644 index 0000000000000..4f94ff4961fb9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceTdeCertificates.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceTdeCertificates. */ +public interface ManagedInstanceTdeCertificates { + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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. + */ + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate 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. + */ + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java new file mode 100644 index 0000000000000..6ff49995cd37d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java @@ -0,0 +1,751 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An update request for an Azure SQL Database managed instance. */ +@JsonFlatten +@Fluent +public class ManagedInstanceUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceUpdate.class); + + /* + * Managed instance sku + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Managed instance identity + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The provisioningState property. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstancePropertiesProvisioningState provisioningState; + + /* + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + + /* + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * Administrator username for the managed instance. Can only be specified + * when the managed instance is being created (and is required for + * creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /* + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /* + * The state of the managed instance. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). + */ + @JsonProperty(value = "properties.licenseType") + private ManagedInstanceLicenseType licenseType; + + /* + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /* + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. + */ + @JsonProperty(value = "properties.storageSizeInGB") + private Integer storageSizeInGB; + + /* + * Collation of the managed instance. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /* + * The Dns Zone that the managed instance is in. + */ + @JsonProperty(value = "properties.dnsZone", access = JsonProperty.Access.WRITE_ONLY) + private String dnsZone; + + /* + * The resource id of another managed instance whose DNS zone this managed + * instance will share after creation. + */ + @JsonProperty(value = "properties.dnsZonePartner") + private String dnsZonePartner; + + /* + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /* + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /* + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Connection type used for connecting to the instance. + */ + @JsonProperty(value = "properties.proxyOverride") + private ManagedInstanceProxyOverride proxyOverride; + + /* + * Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in + * registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time + * Zones. + * You can get those registry values via SQL Server by querying SELECT name + * AS timezone_id FROM sys.time_zone_info. + * List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + * An example of valid timezone id is "Pacific Standard Time" or "W. Europe + * Standard Time". + */ + @JsonProperty(value = "properties.timezoneId") + private String timezoneId; + + /* + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + + /* + * Specifies maintenance configuration id to apply to this managed + * instance. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * List of private endpoint connections on a managed instance. + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "properties.minimalTlsVersion") + private String minimalTlsVersion; + + /* + * The storage account type used to store backups for this instance. The + * options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) + * and GRS (GeoRedundantStorage) + */ + @JsonProperty(value = "properties.storageAccountType") + private StorageAccountType storageAccountType; + + /* + * Whether or not the multi-az is enabled. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Get the sku property: Managed instance sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Managed instance sku. + * + * @param sku the sku value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity property: Managed instance identity. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed instance identity. + * + * @param identity the identity value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @return the managedInstanceCreateMode value. + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the administratorLogin property: Administrator username for the managed instance. Can only be specified when + * the managed instance is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator username for the managed instance. Can only be specified when + * the managed instance is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: Subnet resource ID for the managed instance. + * + * @param subnetId the subnetId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state property: The state of the managed instance. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @return the licenseType value. + */ + public ManagedInstanceLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @param licenseType the licenseType value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withLicenseType(ManagedInstanceLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @param vCores the vCores value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @return the storageSizeInGB value. + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @param storageSizeInGB the storageSizeInGB value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Get the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: Collation of the managed instance. + * + * @param collation the collation value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the dnsZone property: The Dns Zone that the managed instance is in. + * + * @return the dnsZone value. + */ + public String dnsZone() { + return this.dnsZone; + } + + /** + * Get the dnsZonePartner property: The resource id of another managed instance whose DNS zone this managed instance + * will share after creation. + * + * @return the dnsZonePartner value. + */ + public String dnsZonePartner() { + return this.dnsZonePartner; + } + + /** + * Set the dnsZonePartner property: The resource id of another managed instance whose DNS zone this managed instance + * will share after creation. + * + * @param dnsZonePartner the dnsZonePartner value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withDnsZonePartner(String dnsZonePartner) { + this.dnsZonePartner = dnsZonePartner; + return this; + } + + /** + * Get the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value. + */ + public Boolean publicDataEndpointEnabled() { + return this.publicDataEndpointEnabled; + } + + /** + * Set the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @param publicDataEndpointEnabled the publicDataEndpointEnabled value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + this.publicDataEndpointEnabled = publicDataEndpointEnabled; + return this; + } + + /** + * Get the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @return the sourceManagedInstanceId value. + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.proxyOverride; + } + + /** + * Set the proxyOverride property: Connection type used for connecting to the instance. + * + * @param proxyOverride the proxyOverride value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + + /** + * Get the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @return the timezoneId value. + */ + public String timezoneId() { + return this.timezoneId; + } + + /** + * Set the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTimezoneId(String timezoneId) { + this.timezoneId = timezoneId; + return this; + } + + /** + * Get the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value. + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a managed instance. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the storageAccountType property: The storage account type used to store backups for this instance. The + * options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + * + * @return the storageAccountType value. + */ + public StorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: The storage account type used to store backups for this instance. The + * options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + * + * @param storageAccountType the storageAccountType value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withStorageAccountType(StorageAccountType storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.java new file mode 100644 index 0000000000000..e812b7a17d28f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The managed instance virtual cores capability. */ +@Fluent +public final class ManagedInstanceVcoresCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceVcoresCapability.class); + + /* + * The virtual cores identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The virtual cores value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Integer value; + + /* + * Included size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /* + * Storage size ranges. + */ + @JsonProperty(value = "supportedStorageSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageSizes; + + /* + * True if this service objective is supported for managed instances in an + * instance pool. + */ + @JsonProperty(value = "instancePoolSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean instancePoolSupported; + + /* + * True if this service objective is supported for standalone managed + * instances. + */ + @JsonProperty(value = "standaloneSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean standaloneSupported; + + /* + * List of supported maintenance configurations + */ + @JsonProperty(value = "supportedMaintenanceConfigurations", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaintenanceConfigurations; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The virtual cores identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: The virtual cores value. + * + * @return the value value. + */ + public Integer value() { + return this.value; + } + + /** + * Get the includedMaxSize property: Included size. + * + * @return the includedMaxSize value. + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the supportedStorageSizes property: Storage size ranges. + * + * @return the supportedStorageSizes value. + */ + public List supportedStorageSizes() { + return this.supportedStorageSizes; + } + + /** + * Get the instancePoolSupported property: True if this service objective is supported for managed instances in an + * instance pool. + * + * @return the instancePoolSupported value. + */ + public Boolean instancePoolSupported() { + return this.instancePoolSupported; + } + + /** + * Get the standaloneSupported property: True if this service objective is supported for standalone managed + * instances. + * + * @return the standaloneSupported value. + */ + public Boolean standaloneSupported() { + return this.standaloneSupported; + } + + /** + * Get the supportedMaintenanceConfigurations property: List of supported maintenance configurations. + * + * @return the supportedMaintenanceConfigurations value. + */ + public List supportedMaintenanceConfigurations() { + return this.supportedMaintenanceConfigurations; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ManagedInstanceVcoresCapability object itself. + */ + public ManagedInstanceVcoresCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (includedMaxSize() != null) { + includedMaxSize().validate(); + } + if (supportedStorageSizes() != null) { + supportedStorageSizes().forEach(e -> e.validate()); + } + if (supportedMaintenanceConfigurations() != null) { + supportedMaintenanceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.java new file mode 100644 index 0000000000000..ef03de0861575 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The managed instance capability. */ +@Fluent +public final class ManagedInstanceVersionCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedInstanceVersionCapability.class); + + /* + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The list of supported managed instance editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /* + * The list of supported instance pool editions. + */ + @JsonProperty(value = "supportedInstancePoolEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedInstancePoolEditions; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The server version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedEditions property: The list of supported managed instance editions. + * + * @return the supportedEditions value. + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the supportedInstancePoolEditions property: The list of supported instance pool editions. + * + * @return the supportedInstancePoolEditions value. + */ + public List supportedInstancePoolEditions() { + return this.supportedInstancePoolEditions; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ManagedInstanceVersionCapability object itself. + */ + public ManagedInstanceVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedEditions() != null) { + supportedEditions().forEach(e -> e.validate()); + } + if (supportedInstancePoolEditions() != null) { + supportedInstancePoolEditions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.java new file mode 100644 index 0000000000000..89482d6744790 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; + +/** An immutable client-side representation of ManagedInstanceVulnerabilityAssessment. */ +public interface ManagedInstanceVulnerabilityAssessment { + /** + * 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 storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * Gets the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner + * object. + * + * @return the inner object. + */ + ManagedInstanceVulnerabilityAssessmentInner innerModel(); + + /** The entirety of the ManagedInstanceVulnerabilityAssessment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceVulnerabilityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceVulnerabilityAssessment definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is + * defined. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment 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.WithStorageContainerPath, + DefinitionStages.WithStorageContainerSasKey, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRecurringScans { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceVulnerabilityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceVulnerabilityAssessment create(Context context); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify storageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify + * storageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has read and + * write access to the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the + * blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify + * storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Begins update for the ManagedInstanceVulnerabilityAssessment resource. + * + * @return the stage of resource update. + */ + ManagedInstanceVulnerabilityAssessment.Update update(); + + /** The template for ManagedInstanceVulnerabilityAssessment update. */ + interface Update + extends UpdateStages.WithStorageContainerPath, + UpdateStages.WithStorageContainerSasKey, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRecurringScans { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceVulnerabilityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceVulnerabilityAssessment apply(Context context); + } + /** The ManagedInstanceVulnerabilityAssessment update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + Update withStorageContainerPath(String storageContainerPath); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify storageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has read and + * write access to the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the + * blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceVulnerabilityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceVulnerabilityAssessment refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.java new file mode 100644 index 0000000000000..2cbd0287a96d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the ManagedInstance's vulnerability assessments. */ +@Immutable +public final class ManagedInstanceVulnerabilityAssessmentListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedInstanceVulnerabilityAssessmentListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.java new file mode 100644 index 0000000000000..e5e6b621bf3ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstanceVulnerabilityAssessments. */ +public interface ManagedInstanceVulnerabilityAssessments { + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managed instance's vulnerability assessment. + */ + ManagedInstanceVulnerabilityAssessment get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managed instance's vulnerability assessment. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @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 managed instance's vulnerability assessment policies. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets the managed instance's vulnerability assessment policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @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 managed instance's vulnerability assessment policies. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment. + */ + ManagedInstanceVulnerabilityAssessment getById(String id); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @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 managed instance's vulnerability assessment. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @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); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @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 ManagedInstanceVulnerabilityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceVulnerabilityAssessment definition. + */ + ManagedInstanceVulnerabilityAssessment.DefinitionStages.Blank define(VulnerabilityAssessmentName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.java new file mode 100644 index 0000000000000..ed213b6ea66de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedInstances. */ +public interface ManagedInstances { + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool. + */ + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Context context); + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of managed instances in a resource group. + * + * @param resourceGroupName The 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 a list of managed instances in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance. + */ + ManagedInstance getByResourceGroup(String resourceGroupName, String managedInstanceName); + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed instance. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, Context context); + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 top resource consuming queries of a managed instance. + */ + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Get top resource consuming queries of a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @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 top resource consuming queries of a managed instance. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @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 failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @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 failover(String resourceGroupName, String managedInstanceName); + + /** + * Failovers a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context); + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription. + */ + PagedIterable list(); + + /** + * Gets a list of all managed instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a managed instance. + * + * @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 managed instance. + */ + ManagedInstance getById(String id); + + /** + * Gets a managed instance. + * + * @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 managed instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a managed instance. + * + * @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 managed instance. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstance resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstance definition. + */ + ManagedInstance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..c7fed27e59639 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; + +/** Resource collection API of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. */ +public interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName); + + /** + * Gets a dropped database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The long term retention policy info. + * @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 short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list. + */ + PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list. + */ + PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerCreateMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerCreateMode.java new file mode 100644 index 0000000000000..f6ee40d36f6dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerCreateMode.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedServerCreateMode. */ +public final class ManagedServerCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode DEFAULT = fromString("Default"); + + /** Static value PointInTimeRestore for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates or finds a ManagedServerCreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServerCreateMode. + */ + @JsonCreator + public static ManagedServerCreateMode fromString(String name) { + return fromString(name, ManagedServerCreateMode.class); + } + + /** @return known ManagedServerCreateMode values. */ + public static Collection values() { + return values(ManagedServerCreateMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..896099117b329 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ManagedServerSecurityAlertPolicies. */ +public interface ManagedServerSecurityAlertPolicies { + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed server's threat detection policy. + */ + ManagedServerSecurityAlertPolicy get( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName); + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 managed server's threat detection policy. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context); + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed server's threat detection policies. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Get the managed server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 managed server's threat detection policies. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Get a managed server's threat detection policy. + * + * @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 managed server's threat detection policy. + */ + ManagedServerSecurityAlertPolicy getById(String id); + + /** + * Get a managed server's threat detection policy. + * + * @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 managed server's threat detection policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedServerSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedServerSecurityAlertPolicy definition. + */ + ManagedServerSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyNameAutoGenerated name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..9e50bf11a1d59 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ManagedServerSecurityAlertPolicy. */ +public interface ManagedServerSecurityAlertPolicy { + /** + * 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 state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner + * object. + * + * @return the inner object. + */ + ManagedServerSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ManagedServerSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedServerSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedServerSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedServerSecurityAlertPolicy 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.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedServerSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedServerSecurityAlertPolicy create(Context context); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ManagedServerSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ManagedServerSecurityAlertPolicy.Update update(); + + /** The template for ManagedServerSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedServerSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedServerSecurityAlertPolicy apply(Context context); + } + /** The ManagedServerSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + Update withState(SecurityAlertPolicyState state); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedServerSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedServerSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.java new file mode 100644 index 0000000000000..cfca0c05d5ef5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the managed Server's security alert policies. */ +@Immutable +public final class ManagedServerSecurityAlertPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedServerSecurityAlertPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedShortTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedShortTermRetentionPolicyName.java new file mode 100644 index 0000000000000..783490eb2ed17 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedShortTermRetentionPolicyName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedShortTermRetentionPolicyName. */ +public final class ManagedShortTermRetentionPolicyName + extends ExpandableStringEnum { + /** Static value default for ManagedShortTermRetentionPolicyName. */ + public static final ManagedShortTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ManagedShortTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedShortTermRetentionPolicyName. + */ + @JsonCreator + public static ManagedShortTermRetentionPolicyName fromString(String name) { + return fromString(name, ManagedShortTermRetentionPolicyName.class); + } + + /** @return known ManagedShortTermRetentionPolicyName values. */ + public static Collection values() { + return values(ManagedShortTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagementOperationState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagementOperationState.java new file mode 100644 index 0000000000000..7129406feca67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagementOperationState.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagementOperationState. */ +public final class ManagementOperationState extends ExpandableStringEnum { + /** Static value Pending for ManagementOperationState. */ + public static final ManagementOperationState PENDING = fromString("Pending"); + + /** Static value InProgress for ManagementOperationState. */ + public static final ManagementOperationState IN_PROGRESS = fromString("InProgress"); + + /** Static value Succeeded for ManagementOperationState. */ + public static final ManagementOperationState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ManagementOperationState. */ + public static final ManagementOperationState FAILED = fromString("Failed"); + + /** Static value CancelInProgress for ManagementOperationState. */ + public static final ManagementOperationState CANCEL_IN_PROGRESS = fromString("CancelInProgress"); + + /** Static value Cancelled for ManagementOperationState. */ + public static final ManagementOperationState CANCELLED = fromString("Cancelled"); + + /** + * Creates or finds a ManagementOperationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagementOperationState. + */ + @JsonCreator + public static ManagementOperationState fromString(String name) { + return fromString(name, ManagementOperationState.class); + } + + /** @return known ManagementOperationState values. */ + public static Collection values() { + return values(ManagementOperationState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.java new file mode 100644 index 0000000000000..54a94aa723f4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maximum size capability. */ +@Immutable +public final class MaxSizeCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MaxSizeCapability.class); + + /* + * The maximum size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /* + * The units that the limit is expressed in. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeUnit unit; + + /** + * Get the limit property: The maximum size limit (see 'unit' for the units). + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the unit property: The units that the limit is expressed in. + * + * @return the unit value. + */ + public MaxSizeUnit unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.java new file mode 100644 index 0000000000000..b13fa2849008f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 maximum size range capability. */ +@Fluent +public final class MaxSizeRangeCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MaxSizeRangeCapability.class); + + /* + * Minimum value. + */ + @JsonProperty(value = "minValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability minValue; + + /* + * Maximum value. + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability maxValue; + + /* + * Scale/step size for discrete values between the minimum value and the + * maximum value. + */ + @JsonProperty(value = "scaleSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability scaleSize; + + /* + * Size of transaction log. + */ + @JsonProperty(value = "logSize", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeCapability logSize; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the minValue property: Minimum value. + * + * @return the minValue value. + */ + public MaxSizeCapability minValue() { + return this.minValue; + } + + /** + * Get the maxValue property: Maximum value. + * + * @return the maxValue value. + */ + public MaxSizeCapability maxValue() { + return this.maxValue; + } + + /** + * Get the scaleSize property: Scale/step size for discrete values between the minimum value and the maximum value. + * + * @return the scaleSize value. + */ + public MaxSizeCapability scaleSize() { + return this.scaleSize; + } + + /** + * Get the logSize property: Size of transaction log. + * + * @return the logSize value. + */ + public LogSizeCapability logSize() { + return this.logSize; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the MaxSizeRangeCapability object itself. + */ + public MaxSizeRangeCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (minValue() != null) { + minValue().validate(); + } + if (maxValue() != null) { + maxValue().validate(); + } + if (scaleSize() != null) { + scaleSize().validate(); + } + if (logSize() != null) { + logSize().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeUnit.java new file mode 100644 index 0000000000000..d4aff6348c4db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeUnit.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MaxSizeUnit. */ +public final class MaxSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for MaxSizeUnit. */ + public static final MaxSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for MaxSizeUnit. */ + public static final MaxSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for MaxSizeUnit. */ + public static final MaxSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for MaxSizeUnit. */ + public static final MaxSizeUnit PETABYTES = fromString("Petabytes"); + + /** + * Creates or finds a MaxSizeUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding MaxSizeUnit. + */ + @JsonCreator + public static MaxSizeUnit fromString(String name) { + return fromString(name, MaxSizeUnit.class); + } + + /** @return known MaxSizeUnit values. */ + public static Collection values() { + return values(MaxSizeUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Metric.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Metric.java new file mode 100644 index 0000000000000..060e7ff61b36a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Metric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Metric. */ +public interface Metric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time step to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MetricInner object. + * + * @return the inner object. + */ + MetricInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.java new file mode 100644 index 0000000000000..e316478f5d64c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** A metric availability value. */ +@Immutable +public final class MetricAvailability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAvailability.class); + + /* + * The length of retention for the database metric. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /* + * The granularity of the database metric. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * Get the retention property: The length of retention for the database metric. + * + * @return the retention value. + */ + public String retention() { + return this.retention; + } + + /** + * Get the timeGrain property: The granularity of the database metric. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinition.java new file mode 100644 index 0000000000000..d9d41328520f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinition.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of MetricDefinition. */ +public interface MetricDefinition { + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the primaryAggregationType property: The primary aggregation type defining how metric values are displayed. + * + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * Gets the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitDefinitionType unit(); + + /** + * Gets the metricAvailabilities property: The list of database metric availabilities for the metric. + * + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner object. + * + * @return the inner object. + */ + MetricDefinitionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.java new file mode 100644 index 0000000000000..4c6f5da169a4e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database metric definitions request. */ +@Fluent +public final class MetricDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionListResult.class); + + /* + * The list of metric definitions for the database. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of metric definitions for the database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of metric definitions for the database. + * + * @param value the value value to set. + * @return the MetricDefinitionListResult object itself. + */ + public MetricDefinitionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model MetricDefinitionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.java new file mode 100644 index 0000000000000..22faba2b2d09f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database metrics request. */ +@Fluent +public final class MetricListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricListResult.class); + + /* + * The list of metrics for the database. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of metrics for the database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of metrics for the database. + * + * @param value the value value to set. + * @return the MetricListResult object itself. + */ + public MetricListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model MetricListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.java new file mode 100644 index 0000000000000..c5ab0f698ef3b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** A database metric name. */ +@Immutable +public final class MetricName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricName.class); + + /* + * The name of the database metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /* + * The friendly name of the database metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the value property: The name of the database metric. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: The friendly name of the database metric. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricType.java new file mode 100644 index 0000000000000..e8e66292b3910 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MetricType. */ +public final class MetricType extends ExpandableStringEnum { + /** Static value cpu for MetricType. */ + public static final MetricType CPU = fromString("cpu"); + + /** Static value io for MetricType. */ + public static final MetricType IO = fromString("io"); + + /** Static value logIo for MetricType. */ + public static final MetricType LOG_IO = fromString("logIo"); + + /** Static value duration for MetricType. */ + public static final MetricType DURATION = fromString("duration"); + + /** Static value dtu for MetricType. */ + public static final MetricType DTU = fromString("dtu"); + + /** + * Creates or finds a MetricType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricType. + */ + @JsonCreator + public static MetricType fromString(String name) { + return fromString(name, MetricType.class); + } + + /** @return known MetricType values. */ + public static Collection values() { + return values(MetricType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.java new file mode 100644 index 0000000000000..6b5bdc9dad2e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.time.OffsetDateTime; + +/** Represents database metrics. */ +@Immutable +public final class MetricValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricValue.class); + + /* + * The number of values for the metric. + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /* + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /* + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /* + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /* + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** + * Get the count property: The number of values for the metric. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Get the average property: The average value of the metric. + * + * @return the average value. + */ + public Double average() { + return this.average; + } + + /** + * Get the maximum property: The max value of the metric. + * + * @return the maximum value. + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the minimum property: The min value of the metric. + * + * @return the minimum value. + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the timestamp property: The metric timestamp (ISO-8601 format). + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total property: The total value of the metric. + * + * @return the total value. + */ + public Double total() { + return this.total; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.java new file mode 100644 index 0000000000000..edb6af3a4b2e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.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.sql.generated.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 min capacity capability. */ +@Fluent +public final class MinCapacityCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MinCapacityCapability.class); + + /* + * Min capacity value + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the value property: Min capacity value. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the MinCapacityCapability object itself. + */ + public MinCapacityCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.java new file mode 100644 index 0000000000000..cd74ec0308eeb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** ARM Usage Name. */ +@Fluent +public final class Name { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Name.class); + + /* + * Usage name value + */ + @JsonProperty(value = "value") + private String value; + + /* + * Usage name localized value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the value property: Usage name value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Usage name value. + * + * @param value the value value to set. + * @return the Name object itself. + */ + public Name withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: Usage name localized value. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: Usage name localized value. + * + * @param localizedValue the localizedValue value to set. + * @return the Name object itself. + */ + public Name withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.java new file mode 100644 index 0000000000000..7045ededcadb9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the ARM resources for which to create private endpoint connection. */ +@Fluent +public final class NetworkIsolationSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkIsolationSettings.class); + + /* + * The resource id for the storage account used to store BACPAC file. If + * set, private endpoint connection will be created for the storage + * account. Must match storage account used for StorageUri parameter. + */ + @JsonProperty(value = "storageAccountResourceId") + private String storageAccountResourceId; + + /* + * The resource id for the SQL server which is the target of this request. + * If set, private endpoint connection will be created for the SQL server. + * Must match server which is target of the operation. + */ + @JsonProperty(value = "sqlServerResourceId") + private String sqlServerResourceId; + + /** + * Get the storageAccountResourceId property: The resource id for the storage account used to store BACPAC file. If + * set, private endpoint connection will be created for the storage account. Must match storage account used for + * StorageUri parameter. + * + * @return the storageAccountResourceId value. + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Set the storageAccountResourceId property: The resource id for the storage account used to store BACPAC file. If + * set, private endpoint connection will be created for the storage account. Must match storage account used for + * StorageUri parameter. + * + * @param storageAccountResourceId the storageAccountResourceId value to set. + * @return the NetworkIsolationSettings object itself. + */ + public NetworkIsolationSettings withStorageAccountResourceId(String storageAccountResourceId) { + this.storageAccountResourceId = storageAccountResourceId; + return this; + } + + /** + * Get the sqlServerResourceId property: The resource id for the SQL server which is the target of this request. If + * set, private endpoint connection will be created for the SQL server. Must match server which is target of the + * operation. + * + * @return the sqlServerResourceId value. + */ + public String sqlServerResourceId() { + return this.sqlServerResourceId; + } + + /** + * Set the sqlServerResourceId property: The resource id for the SQL server which is the target of this request. If + * set, private endpoint connection will be created for the SQL server. Must match server which is target of the + * operation. + * + * @param sqlServerResourceId the sqlServerResourceId value to set. + * @return the NetworkIsolationSettings object itself. + */ + public NetworkIsolationSettings withSqlServerResourceId(String sqlServerResourceId) { + this.sqlServerResourceId = sqlServerResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operation.java new file mode 100644 index 0000000000000..5dd37d6dd7953 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.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.sql.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationDisplay.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..5331a5888918a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationImpact.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationImpact.java new file mode 100644 index 0000000000000..cd19b4efc1c31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationImpact.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The impact of an operation, both in absolute and relative terms. */ +@Immutable +public final class OperationImpact { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationImpact.class); + + /* + * The name of the impact dimension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The unit in which estimated impact to dimension is measured. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * The absolute impact to dimension. + */ + @JsonProperty(value = "changeValueAbsolute", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueAbsolute; + + /* + * The relative impact to dimension (null if not applicable) + */ + @JsonProperty(value = "changeValueRelative", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueRelative; + + /** + * Get the name property: The name of the impact dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the unit property: The unit in which estimated impact to dimension is measured. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the changeValueAbsolute property: The absolute impact to dimension. + * + * @return the changeValueAbsolute value. + */ + public Double changeValueAbsolute() { + return this.changeValueAbsolute; + } + + /** + * Get the changeValueRelative property: The relative impact to dimension (null if not applicable). + * + * @return the changeValueRelative value. + */ + public Double changeValueRelative() { + return this.changeValueRelative; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationListResult.java new file mode 100644 index 0000000000000..a71609d2d8926 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationOrigin.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationOrigin.java new file mode 100644 index 0000000000000..509c5f8daac7b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operations.java new file mode 100644 index 0000000000000..43b06f5fd9f20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/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.sql.generated.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 Rest API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + PagedIterable list(); + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.java new file mode 100644 index 0000000000000..eb0c94f70a442 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Partner server information for the failover group. */ +@Fluent +public final class PartnerInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartnerInfo.class); + + /* + * Resource identifier of the partner server. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Geo location of the partner server. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Replication role of the partner server. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /** + * Get the id property: Resource identifier of the partner server. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource identifier of the partner server. + * + * @param id the id value to set. + * @return the PartnerInfo object itself. + */ + public PartnerInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the location property: Geo location of the partner server. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the replicationRole property: Replication role of the partner server. + * + * @return the replicationRole value. + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property id in model PartnerInfo")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.java new file mode 100644 index 0000000000000..3df3b7aab3bb1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Partner region information for the failover group. */ +@Fluent +public final class PartnerRegionInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartnerRegionInfo.class); + + /* + * Geo location of the partner managed instances. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Replication role of the partner managed instances. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Get the location property: Geo location of the partner managed instances. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Geo location of the partner managed instances. + * + * @param location the location value to set. + * @return the PartnerRegionInfo object itself. + */ + public PartnerRegionInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the replicationRole property: Replication role of the partner managed instances. + * + * @return the replicationRole value. + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PauseDelayTimeUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PauseDelayTimeUnit.java new file mode 100644 index 0000000000000..f893433043bbb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PauseDelayTimeUnit.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PauseDelayTimeUnit. */ +public final class PauseDelayTimeUnit extends ExpandableStringEnum { + /** Static value Minutes for PauseDelayTimeUnit. */ + public static final PauseDelayTimeUnit MINUTES = fromString("Minutes"); + + /** + * Creates or finds a PauseDelayTimeUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding PauseDelayTimeUnit. + */ + @JsonCreator + public static PauseDelayTimeUnit fromString(String name) { + return fromString(name, PauseDelayTimeUnit.class); + } + + /** @return known PauseDelayTimeUnit values. */ + public static Collection values() { + return values(PauseDelayTimeUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.java new file mode 100644 index 0000000000000..51d0fe868e4cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The performance level capability. */ +@Immutable +public final class PerformanceLevelCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceLevelCapability.class); + + /* + * Performance level value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /* + * Unit type used to measure performance level. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * Get the value property: Performance level value. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Get the unit property: Unit type used to measure performance level. + * + * @return the unit value. + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelUnit.java new file mode 100644 index 0000000000000..48b4fafa2d34e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelUnit.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PerformanceLevelUnit. */ +public final class PerformanceLevelUnit extends ExpandableStringEnum { + /** Static value DTU for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit DTU = fromString("DTU"); + + /** Static value VCores for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit VCORES = fromString("VCores"); + + /** + * Creates or finds a PerformanceLevelUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding PerformanceLevelUnit. + */ + @JsonCreator + public static PerformanceLevelUnit fromString(String name) { + return fromString(name, PerformanceLevelUnit.class); + } + + /** @return known PerformanceLevelUnit values. */ + public static Collection values() { + return values(PerformanceLevelUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrimaryAggregationType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrimaryAggregationType.java new file mode 100644 index 0000000000000..10f3ceb70c73c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrimaryAggregationType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrimaryAggregationType. */ +public final class PrimaryAggregationType extends ExpandableStringEnum { + /** Static value None for PrimaryAggregationType. */ + public static final PrimaryAggregationType NONE = fromString("None"); + + /** Static value Average for PrimaryAggregationType. */ + public static final PrimaryAggregationType AVERAGE = fromString("Average"); + + /** Static value Count for PrimaryAggregationType. */ + public static final PrimaryAggregationType COUNT = fromString("Count"); + + /** Static value Minimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMUM = fromString("Minimum"); + + /** Static value Maximum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Total for PrimaryAggregationType. */ + public static final PrimaryAggregationType TOTAL = fromString("Total"); + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrimaryAggregationType. + */ + @JsonCreator + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** @return known PrimaryAggregationType values. */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..4f38cb3c220b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * 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 privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + PrivateEndpointProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the PrivateEndpointConnection 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.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..69ae6a8299ae0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..3c4cc0e84f9d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointProvisioningState provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.java new file mode 100644 index 0000000000000..07203ef4ea3a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the private endpoint connection requests status. */ +@Immutable +public final class PrivateEndpointConnectionRequestStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionRequestStatus.class); + + /* + * Resource id for which the private endpoint is created. + */ + @JsonProperty(value = "privateLinkServiceId", access = JsonProperty.Access.WRITE_ONLY) + private String privateLinkServiceId; + + /* + * The connection name for the private endpoint. + */ + @JsonProperty(value = "privateEndpointConnectionName", access = JsonProperty.Access.WRITE_ONLY) + private String privateEndpointConnectionName; + + /* + * Status of this private endpoint connection. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the privateLinkServiceId property: Resource id for which the private endpoint is created. + * + * @return the privateLinkServiceId value. + */ + public String privateLinkServiceId() { + return this.privateLinkServiceId; + } + + /** + * Get the privateEndpointConnectionName property: The connection name for the private endpoint. + * + * @return the privateEndpointConnectionName value. + */ + public String privateEndpointConnectionName() { + return this.privateEndpointConnectionName; + } + + /** + * Get the status property: Status of this private endpoint connection. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnections.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..4606f288c5f60 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 all private endpoint connections on a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private endpoint connection. + * + * @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 private endpoint connection. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @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 private endpoint connection. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..006c5d74530d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 PrivateEndpointProperty model. */ +@Fluent +public final class PrivateEndpointProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointProperty.class); + + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProvisioningState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProvisioningState.java new file mode 100644 index 0000000000000..ed909db6ee655 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProvisioningState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointProvisioningState. */ +public final class PrivateEndpointProvisioningState extends ExpandableStringEnum { + /** Static value Approving for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState APPROVING = fromString("Approving"); + + /** Static value Ready for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState READY = fromString("Ready"); + + /** Static value Dropping for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState DROPPING = fromString("Dropping"); + + /** Static value Failed for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState FAILED = fromString("Failed"); + + /** Static value Rejecting for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState REJECTING = fromString("Rejecting"); + + /** + * Creates or finds a PrivateEndpointProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointProvisioningState. + */ + @JsonCreator + public static PrivateEndpointProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointProvisioningState.class); + } + + /** @return known PrivateEndpointProvisioningState values. */ + public static Collection values() { + return values(PrivateEndpointProvisioningState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResource.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..f61a7bc7ceda3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResource.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * 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 properties property: The private link resource group id. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..ed34143f89ca0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class PrivateLinkResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..4552832a644cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResources.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..41949fc721f8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResources.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 the private link resources for SQL server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 private link resources for SQL server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @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 private link resource for SQL server. + */ + PrivateLinkResource get(String resourceGroupName, String serverName, String groupName); + + /** + * Gets a private link resource for SQL server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @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 private link resource for SQL server. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateActionsRequire.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateActionsRequire.java new file mode 100644 index 0000000000000..bf18f5524743e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateActionsRequire.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateActionsRequire. */ +public final class PrivateLinkServiceConnectionStateActionsRequire + extends ExpandableStringEnum { + /** Static value None for PrivateLinkServiceConnectionStateActionsRequire. */ + public static final PrivateLinkServiceConnectionStateActionsRequire NONE = fromString("None"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateActionsRequire from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateActionsRequire. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateActionsRequire fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateActionsRequire.class); + } + + /** @return known PrivateLinkServiceConnectionStateActionsRequire values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateActionsRequire.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..aa1906410b50d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 PrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStateStatus status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkServiceConnectionStateActionsRequire actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStateStatus status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(PrivateLinkServiceConnectionStateStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public PrivateLinkServiceConnectionStateActionsRequire actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionStateProperty")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateStatus.java new file mode 100644 index 0000000000000..18811b9bcaea2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateStatus.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateStatus. */ +public final class PrivateLinkServiceConnectionStateStatus + extends ExpandableStringEnum { + /** Static value Approved for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus APPROVED = fromString("Approved"); + + /** Static value Pending for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus PENDING = fromString("Pending"); + + /** Static value Rejected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateStatus. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateStatus fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateStatus.class); + } + + /** @return known PrivateLinkServiceConnectionStateStatus values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProvisioningState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProvisioningState.java new file mode 100644 index 0000000000000..281b41668d640 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProvisioningState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** Static value InProgress for ProvisioningState. */ + public static final ProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.java new file mode 100644 index 0000000000000..c1aa451a3d802 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties of a query metrics interval. */ +@Fluent +public final class QueryMetricInterval { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryMetricInterval.class); + + /* + * The start time for the metric interval (ISO-8601 format). + */ + @JsonProperty(value = "intervalStartTime", access = JsonProperty.Access.WRITE_ONLY) + private String intervalStartTime; + + /* + * Interval type (length). + */ + @JsonProperty(value = "intervalType", access = JsonProperty.Access.WRITE_ONLY) + private QueryTimeGrainType intervalType; + + /* + * Execution count of a query in this interval. + */ + @JsonProperty(value = "executionCount", access = JsonProperty.Access.WRITE_ONLY) + private Long executionCount; + + /* + * List of metric objects for this interval + */ + @JsonProperty(value = "metrics") + private List metrics; + + /** + * Get the intervalStartTime property: The start time for the metric interval (ISO-8601 format). + * + * @return the intervalStartTime value. + */ + public String intervalStartTime() { + return this.intervalStartTime; + } + + /** + * Get the intervalType property: Interval type (length). + * + * @return the intervalType value. + */ + public QueryTimeGrainType intervalType() { + return this.intervalType; + } + + /** + * Get the executionCount property: Execution count of a query in this interval. + * + * @return the executionCount value. + */ + public Long executionCount() { + return this.executionCount; + } + + /** + * Get the metrics property: List of metric objects for this interval. + * + * @return the metrics value. + */ + public List metrics() { + return this.metrics; + } + + /** + * Set the metrics property: List of metric objects for this interval. + * + * @param metrics the metrics value to set. + * @return the QueryMetricInterval object itself. + */ + public QueryMetricInterval withMetrics(List metrics) { + this.metrics = metrics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metrics() != null) { + metrics().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.java new file mode 100644 index 0000000000000..b4592e2e811fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.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.sql.generated.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; + +/** Properties of a topquery metric in one interval. */ +@Immutable +public final class QueryMetricProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryMetricProperties.class); + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The UI appropriate name for the metric. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private QueryMetricUnitType unit; + + /* + * The value of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /* + * Metric value when min() aggregate function is used over the interval. + */ + @JsonProperty(value = "min", access = JsonProperty.Access.WRITE_ONLY) + private Double min; + + /* + * Metric value when max() aggregate function is used over the interval. + */ + @JsonProperty(value = "max", access = JsonProperty.Access.WRITE_ONLY) + private Double max; + + /* + * Metric value when avg() aggregate function is used over the interval. + */ + @JsonProperty(value = "avg", access = JsonProperty.Access.WRITE_ONLY) + private Double avg; + + /* + * Metric value when sum() aggregate function is used over the interval. + */ + @JsonProperty(value = "sum", access = JsonProperty.Access.WRITE_ONLY) + private Double sum; + + /* + * Metric value when stdev aggregate function is used over the interval. + */ + @JsonProperty(value = "stdev", access = JsonProperty.Access.WRITE_ONLY) + private Double stdev; + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: The UI appropriate name for the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public QueryMetricUnitType unit() { + return this.unit; + } + + /** + * Get the value property: The value of the metric. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Get the min property: Metric value when min() aggregate function is used over the interval. + * + * @return the min value. + */ + public Double min() { + return this.min; + } + + /** + * Get the max property: Metric value when max() aggregate function is used over the interval. + * + * @return the max value. + */ + public Double max() { + return this.max; + } + + /** + * Get the avg property: Metric value when avg() aggregate function is used over the interval. + * + * @return the avg value. + */ + public Double avg() { + return this.avg; + } + + /** + * Get the sum property: Metric value when sum() aggregate function is used over the interval. + * + * @return the sum value. + */ + public Double sum() { + return this.sum; + } + + /** + * Get the stdev property: Metric value when stdev aggregate function is used over the interval. + * + * @return the stdev value. + */ + public Double stdev() { + return this.stdev; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricUnitType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricUnitType.java new file mode 100644 index 0000000000000..eb2f3556698c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricUnitType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for QueryMetricUnitType. */ +public final class QueryMetricUnitType extends ExpandableStringEnum { + /** Static value percentage for QueryMetricUnitType. */ + public static final QueryMetricUnitType PERCENTAGE = fromString("percentage"); + + /** Static value KB for QueryMetricUnitType. */ + public static final QueryMetricUnitType KB = fromString("KB"); + + /** Static value microseconds for QueryMetricUnitType. */ + public static final QueryMetricUnitType MICROSECONDS = fromString("microseconds"); + + /** Static value count for QueryMetricUnitType. */ + public static final QueryMetricUnitType COUNT = fromString("count"); + + /** + * Creates or finds a QueryMetricUnitType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryMetricUnitType. + */ + @JsonCreator + public static QueryMetricUnitType fromString(String name) { + return fromString(name, QueryMetricUnitType.class); + } + + /** @return known QueryMetricUnitType values. */ + public static Collection values() { + return values(QueryMetricUnitType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatisticsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatisticsProperties.java new file mode 100644 index 0000000000000..c91b14aff29af --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatisticsProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties of a query execution statistics. */ +@Fluent +public final class QueryStatisticsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryStatisticsProperties.class); + + /* + * Database name of the database in which this query was executed. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * Unique query id (unique within one database). + */ + @JsonProperty(value = "queryId", access = JsonProperty.Access.WRITE_ONLY) + private String queryId; + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private String startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private String endTime; + + /* + * List of intervals with appropriate metric data + */ + @JsonProperty(value = "intervals") + private List intervals; + + /** + * Get the databaseName property: Database name of the database in which this query was executed. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the queryId property: Unique query id (unique within one database). + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Get the intervals property: List of intervals with appropriate metric data. + * + * @return the intervals value. + */ + public List intervals() { + return this.intervals; + } + + /** + * Set the intervals property: List of intervals with appropriate metric data. + * + * @param intervals the intervals value to set. + * @return the QueryStatisticsProperties object itself. + */ + public QueryStatisticsProperties withIntervals(List intervals) { + this.intervals = intervals; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (intervals() != null) { + intervals().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryTimeGrainType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryTimeGrainType.java new file mode 100644 index 0000000000000..7ef70944bcf19 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryTimeGrainType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for QueryTimeGrainType. */ +public final class QueryTimeGrainType extends ExpandableStringEnum { + /** Static value PT1H for QueryTimeGrainType. */ + public static final QueryTimeGrainType PT1H = fromString("PT1H"); + + /** Static value P1D for QueryTimeGrainType. */ + public static final QueryTimeGrainType P1D = fromString("P1D"); + + /** + * Creates or finds a QueryTimeGrainType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryTimeGrainType. + */ + @JsonCreator + public static QueryTimeGrainType fromString(String name) { + return fromString(name, QueryTimeGrainType.class); + } + + /** @return known QueryTimeGrainType values. */ + public static Collection values() { + return values(QueryTimeGrainType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadOnlyEndpointFailoverPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadOnlyEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..481cf90bee247 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadOnlyEndpointFailoverPolicy.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReadOnlyEndpointFailoverPolicy. */ +public final class ReadOnlyEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Disabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy DISABLED = fromString("Disabled"); + + /** Static value Enabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy ENABLED = fromString("Enabled"); + + /** + * Creates or finds a ReadOnlyEndpointFailoverPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReadOnlyEndpointFailoverPolicy. + */ + @JsonCreator + public static ReadOnlyEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadOnlyEndpointFailoverPolicy.class); + } + + /** @return known ReadOnlyEndpointFailoverPolicy values. */ + public static Collection values() { + return values(ReadOnlyEndpointFailoverPolicy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.java new file mode 100644 index 0000000000000..84d324820a3a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.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.sql.generated.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 read scale capability. */ +@Fluent +public final class ReadScaleCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReadScaleCapability.class); + + /* + * The maximum number of read scale replicas. + */ + @JsonProperty(value = "maxNumberOfReplicas", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxNumberOfReplicas; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the maxNumberOfReplicas property: The maximum number of read scale replicas. + * + * @return the maxNumberOfReplicas value. + */ + public Integer maxNumberOfReplicas() { + return this.maxNumberOfReplicas; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ReadScaleCapability object itself. + */ + public ReadScaleCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadWriteEndpointFailoverPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadWriteEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..1459f8e15a417 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadWriteEndpointFailoverPolicy.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReadWriteEndpointFailoverPolicy. */ +public final class ReadWriteEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Manual for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy MANUAL = fromString("Manual"); + + /** Static value Automatic for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a ReadWriteEndpointFailoverPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReadWriteEndpointFailoverPolicy. + */ + @JsonCreator + public static ReadWriteEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadWriteEndpointFailoverPolicy.class); + } + + /** @return known ReadWriteEndpointFailoverPolicy values. */ + public static Collection values() { + return values(ReadWriteEndpointFailoverPolicy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPool.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPool.java new file mode 100644 index 0000000000000..f672c09ff0a68 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPool.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of RecommendedElasticPool. */ +public interface RecommendedElasticPool { + /** + * 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 databaseEdition property: The edition of the recommended elastic pool. The ElasticPoolEdition + * enumeration contains all the valid editions. + * + * @return the databaseEdition value. + */ + ElasticPoolEdition databaseEdition(); + + /** + * Gets the dtu property: The DTU for the recommended elastic pool. + * + * @return the dtu value. + */ + Double dtu(); + + /** + * Gets the databaseDtuMin property: The minimum DTU for the database. + * + * @return the databaseDtuMin value. + */ + Double databaseDtuMin(); + + /** + * Gets the databaseDtuMax property: The maximum DTU for the database. + * + * @return the databaseDtuMax value. + */ + Double databaseDtuMax(); + + /** + * Gets the storageMB property: Gets storage size in megabytes. + * + * @return the storageMB value. + */ + Double storageMB(); + + /** + * Gets the observationPeriodStart property: The observation period start (ISO8601 format). + * + * @return the observationPeriodStart value. + */ + OffsetDateTime observationPeriodStart(); + + /** + * Gets the observationPeriodEnd property: The observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value. + */ + OffsetDateTime observationPeriodEnd(); + + /** + * Gets the maxObservedDtu property: Gets maximum observed DTU. + * + * @return the maxObservedDtu value. + */ + Double maxObservedDtu(); + + /** + * Gets the maxObservedStorageMB property: Gets maximum observed storage in megabytes. + * + * @return the maxObservedStorageMB value. + */ + Double maxObservedStorageMB(); + + /** + * Gets the databases property: The list of databases in this pool. Expanded property. + * + * @return the databases value. + */ + List databases(); + + /** + * Gets the metrics property: The list of databases housed in the server. Expanded property. + * + * @return the metrics value. + */ + List metrics(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolInner object. + * + * @return the inner object. + */ + RecommendedElasticPoolInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolListMetricsResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolListMetricsResult.java new file mode 100644 index 0000000000000..1be65a09dd19e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolListMetricsResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list recommended elastic pool metrics request. */ +@Fluent +public final class RecommendedElasticPoolListMetricsResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendedElasticPoolListMetricsResult.class); + + /* + * The list of recommended elastic pools metrics. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of recommended elastic pools metrics. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of recommended elastic pools metrics. + * + * @param value the value value to set. + * @return the RecommendedElasticPoolListMetricsResult object itself. + */ + public RecommendedElasticPoolListMetricsResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RecommendedElasticPoolListMetricsResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolListResult.java new file mode 100644 index 0000000000000..507eb1b2763a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list recommended elastic pool request. */ +@Fluent +public final class RecommendedElasticPoolListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendedElasticPoolListResult.class); + + /* + * The list of recommended elastic pools hosted in the server. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of recommended elastic pools hosted in the server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of recommended elastic pools hosted in the server. + * + * @param value the value value to set. + * @return the RecommendedElasticPoolListResult object itself. + */ + public RecommendedElasticPoolListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RecommendedElasticPoolListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolMetric.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolMetric.java new file mode 100644 index 0000000000000..e2a3006e7cfe8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPoolMetric.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RecommendedElasticPoolMetric. */ +public interface RecommendedElasticPoolMetric { + /** + * Gets the dateTime property: The time of metric (ISO8601 format). + * + * @return the dateTime value. + */ + OffsetDateTime dateTime(); + + /** + * Gets the dtu property: Gets or sets the DTUs (Database Transaction Units). See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @return the dtu value. + */ + Double dtu(); + + /** + * Gets the sizeGB property: Gets or sets size in gigabytes. + * + * @return the sizeGB value. + */ + Double sizeGB(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecommendedElasticPoolMetricInner object. + * + * @return the inner object. + */ + RecommendedElasticPoolMetricInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPools.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPools.java new file mode 100644 index 0000000000000..5944bf9c8d21f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedElasticPools.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 RecommendedElasticPools. */ +public interface RecommendedElasticPools { + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 recommended elastic pool. + */ + RecommendedElasticPool get(String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Gets a recommended elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 recommended elastic pool. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context); + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list recommended elastic pool request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 represents the response to a list recommended elastic pool metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Returns recommended elastic pool metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 represents the response to a list recommended elastic pool metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String recommendedElasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexAction.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexAction.java new file mode 100644 index 0000000000000..dde3404b8b256 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexAction.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RecommendedIndexAction. */ +public enum RecommendedIndexAction { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Drop. */ + DROP("Drop"), + + /** Enum value Rebuild. */ + REBUILD("Rebuild"); + + /** The actual serialized value for a RecommendedIndexAction instance. */ + private final String value; + + RecommendedIndexAction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexAction instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexAction object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexAction fromString(String value) { + RecommendedIndexAction[] items = RecommendedIndexAction.values(); + for (RecommendedIndexAction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexState.java new file mode 100644 index 0000000000000..f6308a3a4dd27 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexState.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RecommendedIndexState. */ +public enum RecommendedIndexState { + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Pending. */ + PENDING("Pending"), + + /** Enum value Executing. */ + EXECUTING("Executing"), + + /** Enum value Verifying. */ + VERIFYING("Verifying"), + + /** Enum value Pending Revert. */ + PENDING_REVERT("Pending Revert"), + + /** Enum value Reverting. */ + REVERTING("Reverting"), + + /** Enum value Reverted. */ + REVERTED("Reverted"), + + /** Enum value Ignored. */ + IGNORED("Ignored"), + + /** Enum value Expired. */ + EXPIRED("Expired"), + + /** Enum value Blocked. */ + BLOCKED("Blocked"), + + /** Enum value Success. */ + SUCCESS("Success"); + + /** The actual serialized value for a RecommendedIndexState instance. */ + private final String value; + + RecommendedIndexState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexState instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexState object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexState fromString(String value) { + RecommendedIndexState[] items = RecommendedIndexState.values(); + for (RecommendedIndexState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexType.java new file mode 100644 index 0000000000000..645bd84b17b97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedIndexType.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.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RecommendedIndexType. */ +public enum RecommendedIndexType { + /** Enum value CLUSTERED. */ + CLUSTERED("CLUSTERED"), + + /** Enum value NONCLUSTERED. */ + NONCLUSTERED("NONCLUSTERED"), + + /** Enum value COLUMNSTORE. */ + COLUMNSTORE("COLUMNSTORE"), + + /** Enum value CLUSTERED COLUMNSTORE. */ + CLUSTERED_COLUMNSTORE("CLUSTERED COLUMNSTORE"); + + /** The actual serialized value for a RecommendedIndexType instance. */ + private final String value; + + RecommendedIndexType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexType instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexType object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexType fromString(String value) { + RecommendedIndexType[] items = RecommendedIndexType.values(); + for (RecommendedIndexType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabase.java new file mode 100644 index 0000000000000..4fe97f9bb963e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabase.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RecoverableDatabase. */ +public interface RecoverableDatabase { + /** + * 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 edition property: The edition of the database. + * + * @return the edition value. + */ + String edition(); + + /** + * Gets the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * Gets the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * Gets the lastAvailableBackupDate property: The last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value. + */ + OffsetDateTime lastAvailableBackupDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner object. + * + * @return the inner object. + */ + RecoverableDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.java new file mode 100644 index 0000000000000..2ef92436325a3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list recoverable databases request. */ +@Fluent +public final class RecoverableDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableDatabaseListResult.class); + + /* + * A list of recoverable databases + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: A list of recoverable databases. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of recoverable databases. + * + * @param value the value value to set. + * @return the RecoverableDatabaseListResult object itself. + */ + public RecoverableDatabaseListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RecoverableDatabaseListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.java new file mode 100644 index 0000000000000..87ef2ffed0525 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 RecoverableDatabases. */ +public interface RecoverableDatabases { + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 recoverable database, which is a resource representing a database's geo backup. + */ + RecoverableDatabase get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a recoverable database, which is a resource representing a database's geo backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 recoverable database, which is a resource representing a database's geo backup. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of recoverable databases. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of recoverable databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of recoverable databases. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabase.java new file mode 100644 index 0000000000000..616d07062dea3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabase.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; + +/** An immutable client-side representation of RecoverableManagedDatabase. */ +public interface RecoverableManagedDatabase { + /** + * 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 lastAvailableBackupDate property: The last available backup date. + * + * @return the lastAvailableBackupDate value. + */ + String lastAvailableBackupDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner object. + * + * @return the inner object. + */ + RecoverableManagedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.java new file mode 100644 index 0000000000000..d6ecd8b9f8c3d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of recoverable managed databases. */ +@Immutable +public final class RecoverableManagedDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableManagedDatabaseListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabases.java new file mode 100644 index 0000000000000..8d73b1026fb9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabases.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 RecoverableManagedDatabases. */ +public interface RecoverableManagedDatabases { + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of recoverable managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database. + */ + RecoverableManagedDatabase get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName); + + /** + * Gets a recoverable managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param recoverableDatabaseName The recoverableDatabaseName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicaType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicaType.java new file mode 100644 index 0000000000000..d5689e2c2a909 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicaType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReplicaType. */ +public final class ReplicaType extends ExpandableStringEnum { + /** Static value Primary for ReplicaType. */ + public static final ReplicaType PRIMARY = fromString("Primary"); + + /** Static value ReadableSecondary for ReplicaType. */ + public static final ReplicaType READABLE_SECONDARY = fromString("ReadableSecondary"); + + /** + * Creates or finds a ReplicaType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicaType. + */ + @JsonCreator + public static ReplicaType fromString(String name) { + return fromString(name, ReplicaType.class); + } + + /** @return known ReplicaType values. */ + public static Collection values() { + return values(ReplicaType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.java new file mode 100644 index 0000000000000..3bb64cfb78e7a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ReplicationLink. */ +public interface ReplicationLink { + /** + * 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: Location of the server that contains this firewall rule. + * + * @return the location value. + */ + String location(); + + /** + * Gets the isTerminationAllowed property: Legacy value indicating whether termination is allowed. Currently always + * returns true. + * + * @return the isTerminationAllowed value. + */ + Boolean isTerminationAllowed(); + + /** + * Gets the replicationMode property: Replication mode of this replication link. + * + * @return the replicationMode value. + */ + String replicationMode(); + + /** + * Gets the partnerServer property: The name of the server hosting the partner database. + * + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * Gets the partnerDatabase property: The name of the partner database. + * + * @return the partnerDatabase value. + */ + String partnerDatabase(); + + /** + * Gets the partnerLocation property: The Azure Region of the partner database. + * + * @return the partnerLocation value. + */ + String partnerLocation(); + + /** + * Gets the role property: The role of the database in the replication link. + * + * @return the role value. + */ + ReplicationRole role(); + + /** + * Gets the partnerRole property: The role of the partner database in the replication link. + * + * @return the partnerRole value. + */ + ReplicationRole partnerRole(); + + /** + * Gets the startTime property: The start time for the replication link. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the percentComplete property: The percentage of seeding complete for the replication link. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the replicationState property: The replication state for the replication link. + * + * @return the replicationState value. + */ + ReplicationState replicationState(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner object. + * + * @return the inner object. + */ + ReplicationLinkInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkListResult.java new file mode 100644 index 0000000000000..9f4cb745a7c52 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a List database replication link request. */ +@Fluent +public final class ReplicationLinkListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReplicationLinkListResult.class); + + /* + * The list of database replication links housed in the database. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of database replication links housed in the database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of database replication links housed in the database. + * + * @param value the value value to set. + * @return the ReplicationLinkListResult object itself. + */ + public ReplicationLinkListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.java new file mode 100644 index 0000000000000..94fedaae9e3cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.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.sql.generated.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 ReplicationLinks. */ +public interface ReplicationLinks { + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 serverName, String databaseName, String linkId); + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 serverName, String databaseName, String linkId, Context context); + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 database replication link. + */ + ReplicationLink get(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Gets a database replication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 database replication link. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failover(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation + * might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @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 unlink( + String resourceGroupName, String serverName, String databaseName, String linkId, UnlinkParameters parameters); + + /** + * Deletes a database replication link in forced or friendly way. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param parameters The required parameters for unlinking replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void unlink( + String resourceGroupName, + String serverName, + String databaseName, + String linkId, + UnlinkParameters parameters, + Context context); + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @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 represents the response to a List database replication link request. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to retrieve links for. + * @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 represents the response to a List database replication link request. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationRole.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationRole.java new file mode 100644 index 0000000000000..1f4e852107301 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationRole.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ReplicationRole. */ +public enum ReplicationRole { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"), + + /** Enum value NonReadableSecondary. */ + NON_READABLE_SECONDARY("NonReadableSecondary"), + + /** Enum value Source. */ + SOURCE("Source"), + + /** Enum value Copy. */ + COPY("Copy"); + + /** The actual serialized value for a ReplicationRole instance. */ + private final String value; + + ReplicationRole(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReplicationRole instance. + * + * @param value the serialized value to parse. + * @return the parsed ReplicationRole object, or null if unable to parse. + */ + @JsonCreator + public static ReplicationRole fromString(String value) { + ReplicationRole[] items = ReplicationRole.values(); + for (ReplicationRole item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationState.java new file mode 100644 index 0000000000000..cb992472f1e46 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReplicationState. */ +public final class ReplicationState extends ExpandableStringEnum { + /** Static value PENDING for ReplicationState. */ + public static final ReplicationState PENDING = fromString("PENDING"); + + /** Static value SEEDING for ReplicationState. */ + public static final ReplicationState SEEDING = fromString("SEEDING"); + + /** Static value CATCH_UP for ReplicationState. */ + public static final ReplicationState CATCH_UP = fromString("CATCH_UP"); + + /** Static value SUSPENDED for ReplicationState. */ + public static final ReplicationState SUSPENDED = fromString("SUSPENDED"); + + /** + * Creates or finds a ReplicationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationState. + */ + @JsonCreator + public static ReplicationState fromString(String name) { + return fromString(name, ReplicationState.class); + } + + /** @return known ReplicationState values. */ + public static Collection values() { + return values(ReplicationState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RequestedBackupStorageRedundancy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RequestedBackupStorageRedundancy.java new file mode 100644 index 0000000000000..05229097f6d2a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RequestedBackupStorageRedundancy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RequestedBackupStorageRedundancy. */ +public final class RequestedBackupStorageRedundancy extends ExpandableStringEnum { + /** Static value Geo for RequestedBackupStorageRedundancy. */ + public static final RequestedBackupStorageRedundancy GEO = fromString("Geo"); + + /** Static value Local for RequestedBackupStorageRedundancy. */ + public static final RequestedBackupStorageRedundancy LOCAL = fromString("Local"); + + /** Static value Zone for RequestedBackupStorageRedundancy. */ + public static final RequestedBackupStorageRedundancy ZONE = fromString("Zone"); + + /** + * Creates or finds a RequestedBackupStorageRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding RequestedBackupStorageRedundancy. + */ + @JsonCreator + public static RequestedBackupStorageRedundancy fromString(String name) { + return fromString(name, RequestedBackupStorageRedundancy.class); + } + + /** @return known RequestedBackupStorageRedundancy values. */ + public static Collection values() { + return values(RequestedBackupStorageRedundancy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.java new file mode 100644 index 0000000000000..61b7cfacb066c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.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.sql.generated.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.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Fluent +public class ResourceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceIdentity.class); + + /* + * The Azure Active Directory principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The identity type. Set this to 'SystemAssigned' in order to + * automatically create and assign an Azure Active Directory principal for + * the resource. + */ + @JsonProperty(value = "type") + private IdentityType type; + + /* + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * Get the principalId property: The Azure Active Directory principal id. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and + * assign an Azure Active Directory principal for the resource. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and + * assign an Azure Active Directory principal for the resource. + * + * @param type the type value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.java new file mode 100644 index 0000000000000..94d389f92cdb1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Contains the information necessary to perform a resource move (rename). */ +@Fluent +public final class ResourceMoveDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceMoveDefinition.class); + + /* + * The target ID for the resource + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: The target ID for the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The target ID for the resource. + * + * @param id the id value to set. + * @return the ResourceMoveDefinition object itself. + */ + public ResourceMoveDefinition withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model ResourceMoveDefinition")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.java new file mode 100644 index 0000000000000..dbb9e443cda32 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RestorableDroppedDatabase. */ +public interface RestorableDroppedDatabase { + /** + * 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 databaseName property: The name of the database. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the edition property: The edition of the database. + * + * @return the edition value. + */ + String edition(); + + /** + * Gets the maxSizeBytes property: The max size in bytes of the database. + * + * @return the maxSizeBytes value. + */ + String maxSizeBytes(); + + /** + * Gets the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * Gets the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * Gets the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + OffsetDateTime deletionDate(); + + /** + * Gets the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner object. + * + * @return the inner object. + */ + RestorableDroppedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.java new file mode 100644 index 0000000000000..79a44ef314b2b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list restorable dropped databases request. */ +@Fluent +public final class RestorableDroppedDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDroppedDatabaseListResult.class); + + /* + * A list of restorable dropped databases + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: A list of restorable dropped databases. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of restorable dropped databases. + * + * @param value the value value to set. + * @return the RestorableDroppedDatabaseListResult object itself. + */ + public RestorableDroppedDatabaseListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RestorableDroppedDatabaseListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.java new file mode 100644 index 0000000000000..5b7882f055a1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 RestorableDroppedDatabases. */ +public interface RestorableDroppedDatabases { + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @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 deleted database that can be restored. + */ + RestorableDroppedDatabase get(String resourceGroupName, String serverName, String restorableDroppededDatabaseId); + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppededDatabaseId The id of the deleted database in the form of + * databaseName,deletionTimeInFileTimeFormat. + * @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 deleted database that can be restored. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppededDatabaseId, Context context); + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of deleted databases that can be restored. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of deleted databases that can be restored. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabase.java new file mode 100644 index 0000000000000..eeb5b85264146 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabase.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of RestorableDroppedManagedDatabase. */ +public interface RestorableDroppedManagedDatabase { + /** + * 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 databaseName property: The name of the database. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + OffsetDateTime deletionDate(); + + /** + * Gets the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner + * object. + * + * @return the inner object. + */ + RestorableDroppedManagedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.java new file mode 100644 index 0000000000000..5b5cea0ec6655 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of restorable dropped managed databases. */ +@Immutable +public final class RestorableDroppedManagedDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDroppedManagedDatabaseListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabases.java new file mode 100644 index 0000000000000..4cab91463c508 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabases.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 RestorableDroppedManagedDatabases. */ +public interface RestorableDroppedManagedDatabases { + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database. + */ + RestorableDroppedManagedDatabase get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestoreDetailsName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestoreDetailsName.java new file mode 100644 index 0000000000000..fb4ea185c0801 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestoreDetailsName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestoreDetailsName. */ +public final class RestoreDetailsName extends ExpandableStringEnum { + /** Static value Default for RestoreDetailsName. */ + public static final RestoreDetailsName DEFAULT = fromString("Default"); + + /** + * Creates or finds a RestoreDetailsName from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreDetailsName. + */ + @JsonCreator + public static RestoreDetailsName fromString(String name) { + return fromString(name, RestoreDetailsName.class); + } + + /** @return known RestoreDetailsName values. */ + public static Collection values() { + return values(RestoreDetailsName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoint.java new file mode 100644 index 0000000000000..a56b9323b12aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoint.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RestorePoint. */ +public interface RestorePoint { + /** + * 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: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the restorePointType property: The type of restore point. + * + * @return the restorePointType value. + */ + RestorePointType restorePointType(); + + /** + * Gets the earliestRestoreDate property: The earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the restorePointCreationDate property: The time the backup was taken. + * + * @return the restorePointCreationDate value. + */ + OffsetDateTime restorePointCreationDate(); + + /** + * Gets the restorePointLabel property: The label of restore point for backup request by user. + * + * @return the restorePointLabel value. + */ + String restorePointLabel(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner object. + * + * @return the inner object. + */ + RestorePointInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.java new file mode 100644 index 0000000000000..ff562082a6cd9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups. */ +@Immutable +public final class RestorePointListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointType.java new file mode 100644 index 0000000000000..ebb021250a665 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RestorePointType. */ +public enum RestorePointType { + /** Enum value CONTINUOUS. */ + CONTINUOUS("CONTINUOUS"), + + /** Enum value DISCRETE. */ + DISCRETE("DISCRETE"); + + /** The actual serialized value for a RestorePointType instance. */ + private final String value; + + RestorePointType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestorePointType instance. + * + * @param value the serialized value to parse. + * @return the parsed RestorePointType object, or null if unable to parse. + */ + @JsonCreator + public static RestorePointType fromString(String value) { + RestorePointType[] items = RestorePointType.values(); + for (RestorePointType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoints.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoints.java new file mode 100644 index 0000000000000..552f5dba8f6e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoints.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 RestorePoints. */ +public interface RestorePoints { + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The definition for creating the restore point of this database. + * @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 database restore points. + */ + RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context); + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 restore point. + */ + RestorePoint get(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * Gets a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 restore point. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context); + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 serverName, String databaseName, String restorePointName); + + /** + * Deletes a restore point. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param restorePointName The name of the restore point. + * @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 serverName, String databaseName, String restorePointName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SampleName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SampleName.java new file mode 100644 index 0000000000000..13f92be6f5dd4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SampleName.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SampleName. */ +public final class SampleName extends ExpandableStringEnum { + /** Static value AdventureWorksLT for SampleName. */ + public static final SampleName ADVENTURE_WORKS_LT = fromString("AdventureWorksLT"); + + /** Static value WideWorldImportersStd for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_STD = fromString("WideWorldImportersStd"); + + /** Static value WideWorldImportersFull for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_FULL = fromString("WideWorldImportersFull"); + + /** + * Creates or finds a SampleName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SampleName. + */ + @JsonCreator + public static SampleName fromString(String name) { + return fromString(name, SampleName.class); + } + + /** @return known SampleName values. */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecondaryType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecondaryType.java new file mode 100644 index 0000000000000..051a530260280 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecondaryType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecondaryType. */ +public final class SecondaryType extends ExpandableStringEnum { + /** Static value Geo for SecondaryType. */ + public static final SecondaryType GEO = fromString("Geo"); + + /** Static value Named for SecondaryType. */ + public static final SecondaryType NAMED = fromString("Named"); + + /** + * Creates or finds a SecondaryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecondaryType. + */ + @JsonCreator + public static SecondaryType fromString(String name) { + return fromString(name, SecondaryType.class); + } + + /** @return known SecondaryType values. */ + public static Collection values() { + return values(SecondaryType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyEmailAccountAdmins.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyEmailAccountAdmins.java new file mode 100644 index 0000000000000..ec5615400904a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyEmailAccountAdmins.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SecurityAlertPolicyEmailAccountAdmins. */ +public enum SecurityAlertPolicyEmailAccountAdmins { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyEmailAccountAdmins instance. */ + private final String value; + + SecurityAlertPolicyEmailAccountAdmins(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyEmailAccountAdmins instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyEmailAccountAdmins object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyEmailAccountAdmins fromString(String value) { + SecurityAlertPolicyEmailAccountAdmins[] items = SecurityAlertPolicyEmailAccountAdmins.values(); + for (SecurityAlertPolicyEmailAccountAdmins item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyName.java new file mode 100644 index 0000000000000..6b89c9d481e64 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityAlertPolicyName. */ +public final class SecurityAlertPolicyName extends ExpandableStringEnum { + /** Static value default for SecurityAlertPolicyName. */ + public static final SecurityAlertPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a SecurityAlertPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityAlertPolicyName. + */ + @JsonCreator + public static SecurityAlertPolicyName fromString(String name) { + return fromString(name, SecurityAlertPolicyName.class); + } + + /** @return known SecurityAlertPolicyName values. */ + public static Collection values() { + return values(SecurityAlertPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyNameAutoGenerated.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyNameAutoGenerated.java new file mode 100644 index 0000000000000..f1e7845c6e622 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyNameAutoGenerated.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityAlertPolicyNameAutoGenerated. */ +public final class SecurityAlertPolicyNameAutoGenerated + extends ExpandableStringEnum { + /** Static value Default for SecurityAlertPolicyNameAutoGenerated. */ + public static final SecurityAlertPolicyNameAutoGenerated DEFAULT = fromString("Default"); + + /** + * Creates or finds a SecurityAlertPolicyNameAutoGenerated from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityAlertPolicyNameAutoGenerated. + */ + @JsonCreator + public static SecurityAlertPolicyNameAutoGenerated fromString(String name) { + return fromString(name, SecurityAlertPolicyNameAutoGenerated.class); + } + + /** @return known SecurityAlertPolicyNameAutoGenerated values. */ + public static Collection values() { + return values(SecurityAlertPolicyNameAutoGenerated.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..b49041a971d95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyState.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SecurityAlertPolicyState. */ +public enum SecurityAlertPolicyState { + /** Enum value New. */ + NEW("New"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyState instance. */ + private final String value; + + SecurityAlertPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyState fromString(String value) { + SecurityAlertPolicyState[] items = SecurityAlertPolicyState.values(); + for (SecurityAlertPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyUseServerDefault.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyUseServerDefault.java new file mode 100644 index 0000000000000..891850cde51d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyUseServerDefault.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SecurityAlertPolicyUseServerDefault. */ +public enum SecurityAlertPolicyUseServerDefault { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyUseServerDefault instance. */ + private final String value; + + SecurityAlertPolicyUseServerDefault(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyUseServerDefault instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyUseServerDefault object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyUseServerDefault fromString(String value) { + SecurityAlertPolicyUseServerDefault[] items = SecurityAlertPolicyUseServerDefault.values(); + for (SecurityAlertPolicyUseServerDefault item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java new file mode 100644 index 0000000000000..393e11fa2cda6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; + +/** An immutable client-side representation of SensitivityLabel. */ +public interface SensitivityLabel { + /** + * 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 labelName property: The label name. + * + * @return the labelName value. + */ + String labelName(); + + /** + * Gets the labelId property: The label ID. + * + * @return the labelId value. + */ + String labelId(); + + /** + * Gets the informationType property: The information type. + * + * @return the informationType value. + */ + String informationType(); + + /** + * Gets the informationTypeId property: The information type ID. + * + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * Gets the isDisabled property: Is sensitivity recommendation disabled. Applicable for recommended sensitivity + * label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. + * + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * Gets the rank property: The rank property. + * + * @return the rank value. + */ + SensitivityLabelRank rank(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner object. + * + * @return the inner object. + */ + SensitivityLabelInner innerModel(); + + /** The entirety of the SensitivityLabel definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SensitivityLabel definition stages. */ + interface DefinitionStages { + /** The first stage of the SensitivityLabel definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SensitivityLabel definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, schemaName, tableName, columnName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @return the next definition stage. + */ + WithCreate withExistingColumn( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + } + /** + * The stage of the SensitivityLabel 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.WithLabelName, + DefinitionStages.WithLabelId, + DefinitionStages.WithInformationType, + DefinitionStages.WithInformationTypeId, + DefinitionStages.WithRank { + /** + * Executes the create request. + * + * @return the created resource. + */ + SensitivityLabel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SensitivityLabel create(Context context); + } + /** The stage of the SensitivityLabel definition allowing to specify labelName. */ + interface WithLabelName { + /** + * Specifies the labelName property: The label name.. + * + * @param labelName The label name. + * @return the next definition stage. + */ + WithCreate withLabelName(String labelName); + } + /** The stage of the SensitivityLabel definition allowing to specify labelId. */ + interface WithLabelId { + /** + * Specifies the labelId property: The label ID.. + * + * @param labelId The label ID. + * @return the next definition stage. + */ + WithCreate withLabelId(String labelId); + } + /** The stage of the SensitivityLabel definition allowing to specify informationType. */ + interface WithInformationType { + /** + * Specifies the informationType property: The information type.. + * + * @param informationType The information type. + * @return the next definition stage. + */ + WithCreate withInformationType(String informationType); + } + /** The stage of the SensitivityLabel definition allowing to specify informationTypeId. */ + interface WithInformationTypeId { + /** + * Specifies the informationTypeId property: The information type ID.. + * + * @param informationTypeId The information type ID. + * @return the next definition stage. + */ + WithCreate withInformationTypeId(String informationTypeId); + } + /** The stage of the SensitivityLabel definition allowing to specify rank. */ + interface WithRank { + /** + * Specifies the rank property: The rank property.. + * + * @param rank The rank property. + * @return the next definition stage. + */ + WithCreate withRank(SensitivityLabelRank rank); + } + } + /** + * Begins update for the SensitivityLabel resource. + * + * @return the stage of resource update. + */ + SensitivityLabel.Update update(); + + /** The template for SensitivityLabel update. */ + interface Update + extends UpdateStages.WithLabelName, + UpdateStages.WithLabelId, + UpdateStages.WithInformationType, + UpdateStages.WithInformationTypeId, + UpdateStages.WithRank { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SensitivityLabel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SensitivityLabel apply(Context context); + } + /** The SensitivityLabel update stages. */ + interface UpdateStages { + /** The stage of the SensitivityLabel update allowing to specify labelName. */ + interface WithLabelName { + /** + * Specifies the labelName property: The label name.. + * + * @param labelName The label name. + * @return the next definition stage. + */ + Update withLabelName(String labelName); + } + /** The stage of the SensitivityLabel update allowing to specify labelId. */ + interface WithLabelId { + /** + * Specifies the labelId property: The label ID.. + * + * @param labelId The label ID. + * @return the next definition stage. + */ + Update withLabelId(String labelId); + } + /** The stage of the SensitivityLabel update allowing to specify informationType. */ + interface WithInformationType { + /** + * Specifies the informationType property: The information type.. + * + * @param informationType The information type. + * @return the next definition stage. + */ + Update withInformationType(String informationType); + } + /** The stage of the SensitivityLabel update allowing to specify informationTypeId. */ + interface WithInformationTypeId { + /** + * Specifies the informationTypeId property: The information type ID.. + * + * @param informationTypeId The information type ID. + * @return the next definition stage. + */ + Update withInformationTypeId(String informationTypeId); + } + /** The stage of the SensitivityLabel update allowing to specify rank. */ + interface WithRank { + /** + * Specifies the rank property: The rank property.. + * + * @param rank The rank property. + * @return the next definition stage. + */ + Update withRank(SensitivityLabelRank rank); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.java new file mode 100644 index 0000000000000..83f11563b3db9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sensitivity labels. */ +@Immutable +public final class SensitivityLabelListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SensitivityLabelListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelRank.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelRank.java new file mode 100644 index 0000000000000..00bba13ff01a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelRank.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SensitivityLabelRank. */ +public enum SensitivityLabelRank { + /** Enum value None. */ + NONE("None"), + + /** Enum value Low. */ + LOW("Low"), + + /** Enum value Medium. */ + MEDIUM("Medium"), + + /** Enum value High. */ + HIGH("High"), + + /** Enum value Critical. */ + CRITICAL("Critical"); + + /** The actual serialized value for a SensitivityLabelRank instance. */ + private final String value; + + SensitivityLabelRank(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelRank instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelRank object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelRank fromString(String value) { + SensitivityLabelRank[] items = SensitivityLabelRank.values(); + for (SensitivityLabelRank item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelSource.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelSource.java new file mode 100644 index 0000000000000..f6b91972f207f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelSource.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SensitivityLabelSource. */ +public enum SensitivityLabelSource { + /** Enum value current. */ + CURRENT("current"), + + /** Enum value recommended. */ + RECOMMENDED("recommended"); + + /** The actual serialized value for a SensitivityLabelSource instance. */ + private final String value; + + SensitivityLabelSource(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelSource instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelSource object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelSource fromString(String value) { + SensitivityLabelSource[] items = SensitivityLabelSource.values(); + for (SensitivityLabelSource item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java new file mode 100644 index 0000000000000..2a5b0de0b2823 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 SensitivityLabels. */ +public interface SensitivityLabels { + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 sensitivity labels of a given database. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken The skipToken parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @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 sensitivity labels of a given database. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + Boolean includeDisabledRecommendations, + String skipToken, + String filter, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + SensitivityLabel get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @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 sensitivity label of a given column. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the sensitivity label of a given column. + * + * @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 SensitivityLabel resource. + * + * @return the first stage of the new SensitivityLabel definition. + */ + SensitivityLabel.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java new file mode 100644 index 0000000000000..e8e71fb82b996 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Server. */ +public interface Server { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * Gets the kind property: Kind of sql server. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * Gets the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * Gets the version property: The version of the server. + * + * @return the version value. + */ + String version(); + + /** + * Gets the state property: The state of the server. + * + * @return the state value. + */ + String state(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + String minimalTlsVersion(); + + /** + * Gets the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + ServerPublicNetworkAccess publicNetworkAccess(); + + /** + * 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.sql.generated.fluent.models.ServerInner object. + * + * @return the inner object. + */ + ServerInner innerModel(); + + /** The entirety of the Server definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Server definition stages. */ + interface DefinitionStages { + /** The first stage of the Server definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Server definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Server definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The 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 Server definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithAdministratorLogin, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithVersion, + DefinitionStages.WithMinimalTlsVersion, + DefinitionStages.WithPublicNetworkAccess { + /** + * Executes the create request. + * + * @return the created resource. + */ + Server create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Server create(Context context); + } + /** The stage of the Server 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 Server definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The Azure Active Directory identity of the server.. + * + * @param identity The Azure Active Directory identity of the server. + * @return the next definition stage. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + /** The stage of the Server definition allowing to specify administratorLogin. */ + interface WithAdministratorLogin { + /** + * Specifies the administratorLogin property: Administrator username for the server. Once created it cannot + * be changed.. + * + * @param administratorLogin Administrator username for the server. Once created it cannot be changed. + * @return the next definition stage. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + /** The stage of the Server definition allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for server + * creation).. + * + * @param administratorLoginPassword The administrator login password (required for server creation). + * @return the next definition stage. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the Server definition allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: The version of the server.. + * + * @param version The version of the server. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + /** The stage of the Server definition allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + WithCreate withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the Server definition allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Whether or not public endpoint access is allowed for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(ServerPublicNetworkAccess publicNetworkAccess); + } + } + /** + * Begins update for the Server resource. + * + * @return the stage of resource update. + */ + Server.Update update(); + + /** The template for Server update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithAdministratorLogin, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithVersion, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithPublicNetworkAccess { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Server apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Server apply(Context context); + } + /** The Server update stages. */ + interface UpdateStages { + /** The stage of the Server update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Server update allowing to specify administratorLogin. */ + interface WithAdministratorLogin { + /** + * Specifies the administratorLogin property: Administrator username for the server. Once created it cannot + * be changed.. + * + * @param administratorLogin Administrator username for the server. Once created it cannot be changed. + * @return the next definition stage. + */ + Update withAdministratorLogin(String administratorLogin); + } + /** The stage of the Server update allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for server + * creation).. + * + * @param administratorLoginPassword The administrator login password (required for server creation). + * @return the next definition stage. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the Server update allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: The version of the server.. + * + * @param version The version of the server. + * @return the next definition stage. + */ + Update withVersion(String version); + } + /** The stage of the Server update allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + Update withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the Server update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Whether or not public endpoint access is allowed for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(ServerPublicNetworkAccess publicNetworkAccess); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Server refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Server refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTuning.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTuning.java new file mode 100644 index 0000000000000..2f5e445f3a9bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTuning.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import java.util.Map; + +/** An immutable client-side representation of ServerAutomaticTuning. */ +public interface ServerAutomaticTuning { + /** + * 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 desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + AutomaticTuningServerMode desiredState(); + + /** + * Gets the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + AutomaticTuningServerMode actualState(); + + /** + * Gets the options property: Automatic tuning options definition. + * + * @return the options value. + */ + Map options(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner object. + * + * @return the inner object. + */ + ServerAutomaticTuningInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTunings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTunings.java new file mode 100644 index 0000000000000..960405a64bbe6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTunings.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; + +/** Resource collection API of ServerAutomaticTunings. */ +public interface ServerAutomaticTunings { + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + ServerAutomaticTuning get(String resourceGroupName, String serverName); + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server-level Automatic Tuning. + */ + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @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 server-level Automatic Tuning. + */ + ServerAutomaticTuning update(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters); + + /** + * Update automatic tuning options on server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested automatic tuning resource state. + * @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 server-level Automatic Tuning. + */ + Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrator.java new file mode 100644 index 0000000000000..475e7a48ec90a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrator.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import java.util.UUID; + +/** An immutable client-side representation of ServerAzureADAdministrator. */ +public interface ServerAzureADAdministrator { + /** + * 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 administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + AdministratorType administratorType(); + + /** + * Gets the login property: Login name of the server administrator. + * + * @return the login value. + */ + String login(); + + /** + * Gets the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + UUID sid(); + + /** + * Gets the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + Boolean azureADOnlyAuthentication(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner object. + * + * @return the inner object. + */ + ServerAzureADAdministratorInner innerModel(); + + /** The entirety of the ServerAzureADAdministrator definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerAzureADAdministrator definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerAzureADAdministrator definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerAzureADAdministrator 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.WithAdministratorType, + DefinitionStages.WithLogin, + DefinitionStages.WithSid, + DefinitionStages.WithTenantId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerAzureADAdministrator create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerAzureADAdministrator create(Context context); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the sever administrator.. + * + * @param administratorType Type of the sever administrator. + * @return the next definition stage. + */ + WithCreate withAdministratorType(AdministratorType administratorType); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the server administrator.. + * + * @param login Login name of the server administrator. + * @return the next definition stage. + */ + WithCreate withLogin(String login); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the server administrator.. + * + * @param sid SID (object ID) of the server administrator. + * @return the next definition stage. + */ + WithCreate withSid(UUID sid); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the administrator.. + * + * @param tenantId Tenant ID of the administrator. + * @return the next definition stage. + */ + WithCreate withTenantId(UUID tenantId); + } + } + /** + * Begins update for the ServerAzureADAdministrator resource. + * + * @return the stage of resource update. + */ + ServerAzureADAdministrator.Update update(); + + /** The template for ServerAzureADAdministrator update. */ + interface Update + extends UpdateStages.WithAdministratorType, + UpdateStages.WithLogin, + UpdateStages.WithSid, + UpdateStages.WithTenantId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerAzureADAdministrator apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerAzureADAdministrator apply(Context context); + } + /** The ServerAzureADAdministrator update stages. */ + interface UpdateStages { + /** The stage of the ServerAzureADAdministrator update allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the sever administrator.. + * + * @param administratorType Type of the sever administrator. + * @return the next definition stage. + */ + Update withAdministratorType(AdministratorType administratorType); + } + /** The stage of the ServerAzureADAdministrator update allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the server administrator.. + * + * @param login Login name of the server administrator. + * @return the next definition stage. + */ + Update withLogin(String login); + } + /** The stage of the ServerAzureADAdministrator update allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the server administrator.. + * + * @param sid SID (object ID) of the server administrator. + * @return the next definition stage. + */ + Update withSid(UUID sid); + } + /** The stage of the ServerAzureADAdministrator update allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the administrator.. + * + * @param tenantId Tenant ID of the administrator. + * @return the next definition stage. + */ + Update withTenantId(UUID tenantId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerAzureADAdministrator refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerAzureADAdministrator refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.java new file mode 100644 index 0000000000000..3476df6978c7a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerAzureADAdministrators. */ +public interface ServerAzureADAdministrators { + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 Azure Active Directory administrator. + */ + ServerAzureADAdministrator get(String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Gets a Azure Active Directory administrator. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 Azure Active Directory administrator. + */ + Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @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 serverName, AdministratorName administratorName); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of Azure Active Directory administrators in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of Azure Active Directory administrators in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of Azure Active Directory administrators in a server. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a Azure Active Directory administrator. + * + * @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 Azure Active Directory administrator. + */ + ServerAzureADAdministrator getById(String id); + + /** + * Gets a Azure Active Directory administrator. + * + * @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 Azure Active Directory administrator. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerAzureADAdministrator resource. + * + * @param name resource name. + * @return the first stage of the new ServerAzureADAdministrator definition. + */ + ServerAzureADAdministrator.DefinitionStages.Blank define(AdministratorName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentication.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentication.java new file mode 100644 index 0000000000000..14134201d6389 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentication.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; + +/** An immutable client-side representation of ServerAzureADOnlyAuthentication. */ +public interface ServerAzureADOnlyAuthentication { + /** + * 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 azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + Boolean azureADOnlyAuthentication(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner object. + * + * @return the inner object. + */ + ServerAzureADOnlyAuthenticationInner innerModel(); + + /** The entirety of the ServerAzureADOnlyAuthentication definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerAzureADOnlyAuthentication definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerAzureADOnlyAuthentication definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerAzureADOnlyAuthentication definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerAzureADOnlyAuthentication 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.WithAzureADOnlyAuthentication { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerAzureADOnlyAuthentication create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerAzureADOnlyAuthentication create(Context context); + } + /** + * The stage of the ServerAzureADOnlyAuthentication definition allowing to specify azureADOnlyAuthentication. + */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + WithCreate withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication); + } + } + /** + * Begins update for the ServerAzureADOnlyAuthentication resource. + * + * @return the stage of resource update. + */ + ServerAzureADOnlyAuthentication.Update update(); + + /** The template for ServerAzureADOnlyAuthentication update. */ + interface Update extends UpdateStages.WithAzureADOnlyAuthentication { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerAzureADOnlyAuthentication apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerAzureADOnlyAuthentication apply(Context context); + } + /** The ServerAzureADOnlyAuthentication update stages. */ + interface UpdateStages { + /** The stage of the ServerAzureADOnlyAuthentication update allowing to specify azureADOnlyAuthentication. */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + Update withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerAzureADOnlyAuthentication refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerAzureADOnlyAuthentication refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.java new file mode 100644 index 0000000000000..637b04bdf2139 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerAzureADOnlyAuthentications. */ +public interface ServerAzureADOnlyAuthentications { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + ServerAzureADOnlyAuthentication get( + String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 specific Azure Active Directory only authentication property. + */ + Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @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 serverName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server Azure Active Directory only authentications. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server Azure Active Directory only authentications. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @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 specific Azure Active Directory only authentication property. + */ + ServerAzureADOnlyAuthentication getById(String id); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @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 specific Azure Active Directory only authentication property. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerAzureADOnlyAuthentication resource. + * + * @param name resource name. + * @return the first stage of the new ServerAzureADOnlyAuthentication definition. + */ + ServerAzureADOnlyAuthentication.DefinitionStages.Blank define(AuthenticationName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..e9963823c1f01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicies.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerBlobAuditingPolicies. */ +public interface ServerBlobAuditingPolicies { + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's blob auditing policy. + */ + ServerBlobAuditingPolicy get(String resourceGroupName, String serverName); + + /** + * Gets a server's blob auditing policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server's blob auditing policy. + */ + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server auditing settings. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists auditing settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server auditing settings. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a server's blob auditing policy. + * + * @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 server's blob auditing policy. + */ + ServerBlobAuditingPolicy getById(String id); + + /** + * Gets a server's blob auditing policy. + * + * @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 server's blob auditing policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerBlobAuditingPolicy resource. + * + * @return the first stage of the new ServerBlobAuditingPolicy definition. + */ + ServerBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..9845a92d47d97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java @@ -0,0 +1,690 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ServerBlobAuditingPolicy. */ +public interface ServerBlobAuditingPolicy { + /** + * 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 state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the queries and + * stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the Azure + * portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. + * Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, and should + * not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified + * for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE EXECUTE RECEIVE + * REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored procedure, + * or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} + * are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure Monitor. In order + * to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs + * category on the database should be also created. Note that for server level audit you should use the 'master' + * database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner object. + * + * @return the inner object. + */ + ServerBlobAuditingPolicyInner innerModel(); + + /** The entirety of the ServerBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerBlobAuditingPolicy 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.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithStorageAccountSubscriptionId, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerBlobAuditingPolicy create(Context context); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Begins update for the ServerBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ServerBlobAuditingPolicy.Update update(); + + /** The template for ServerBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithStorageAccountSubscriptionId, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerBlobAuditingPolicy apply(Context context); + } + /** The ServerBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the policy. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: Specifies the Actions-Groups and Actions to audit. + * + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + * + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, FAILED_DATABASE_AUTHENTICATION_GROUP. + * + *

This above combination is also the set that is configured by default when enabling auditing from the + * Azure portal. + * + *

The supported action groups to audit are (note: choose only specific groups that cover your auditing + * needs. Using unnecessary groups could lead to very large quantities of audit records): + * + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + *

These are groups that cover all sql statements and stored procedures executed against the database, + * and should not be used in combination with other groups as this will result in duplicate audit logs. + * + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT DELETE + * EXECUTE RECEIVE REFERENCES + * + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + * + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + * + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups Specifies the Actions-Groups and Actions to audit. + *

The recommended set of action groups to use is the following combination - this will audit all the + * queries and stored procedures executed against the database, as well as successful and failed logins: + *

BATCH_COMPLETED_GROUP, SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + *

This above combination is also the set that is configured by default when enabling auditing from + * the Azure portal. + *

The supported action groups to audit are (note: choose only specific groups that cover your + * auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + *

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP BACKUP_RESTORE_GROUP DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP DATABASE_OPERATION_GROUP DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP FAILED_DATABASE_AUTHENTICATION_GROUP SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP USER_CHANGE_PASSWORD_GROUP BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + *

These are groups that cover all sql statements and stored procedures executed against the + * database, and should not be used in combination with other groups as this will result in duplicate + * audit logs. + *

For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + *

For Database auditing policy, specific Actions can also be specified (note that Actions cannot be + * specified for Server auditing policy). The supported actions to audit are: SELECT UPDATE INSERT + * DELETE EXECUTE RECEIVE REFERENCES + *

The general form for defining an action to be audited is: {action} ON {object} BY {principal} + *

Note that <object> in the above format can refer to an object like a table, view, or stored + * procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + *

For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on + * SCHEMA::mySchema by public + *

For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * @return the next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether audit events are sent to Azure + * Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + * 'isAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. In order to + * send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as + * true. + *

When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + * diagnostic logs category on the database should be also created. Note that for server level audit you + * should use the 'master' database as {databaseName}. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..b72955c0427a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server auditing settings. */ +@Immutable +public final class ServerBlobAuditingPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerBlobAuditingPolicyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.java new file mode 100644 index 0000000000000..8e6d35b53d680 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; + +/** An immutable client-side representation of ServerCommunicationLink. */ +public interface ServerCommunicationLink { + /** + * 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: Communication link location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: Communication link kind. This property is used for Azure Portal metadata. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the state property: The state. + * + * @return the state value. + */ + String state(); + + /** + * Gets the partnerServer property: The name of the partner server. + * + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * 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.sql.generated.fluent.models.ServerCommunicationLinkInner object. + * + * @return the inner object. + */ + ServerCommunicationLinkInner innerModel(); + + /** The entirety of the ServerCommunicationLink definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerCommunicationLink definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerCommunicationLink definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerCommunicationLink definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerCommunicationLink 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.WithPartnerServer { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerCommunicationLink create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerCommunicationLink create(Context context); + } + /** The stage of the ServerCommunicationLink definition allowing to specify partnerServer. */ + interface WithPartnerServer { + /** + * Specifies the partnerServer property: The name of the partner server.. + * + * @param partnerServer The name of the partner server. + * @return the next definition stage. + */ + WithCreate withPartnerServer(String partnerServer); + } + } + /** + * Begins update for the ServerCommunicationLink resource. + * + * @return the stage of resource update. + */ + ServerCommunicationLink.Update update(); + + /** The template for ServerCommunicationLink update. */ + interface Update extends UpdateStages.WithPartnerServer { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerCommunicationLink apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerCommunicationLink apply(Context context); + } + /** The ServerCommunicationLink update stages. */ + interface UpdateStages { + /** The stage of the ServerCommunicationLink update allowing to specify partnerServer. */ + interface WithPartnerServer { + /** + * Specifies the partnerServer property: The name of the partner server.. + * + * @param partnerServer The name of the partner server. + * @return the next definition stage. + */ + Update withPartnerServer(String partnerServer); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerCommunicationLink refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerCommunicationLink refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.java new file mode 100644 index 0000000000000..dbcb0128fda54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server communication links. */ +@Fluent +public final class ServerCommunicationLinkListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerCommunicationLinkListResult.class); + + /* + * The list of server communication links. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of server communication links. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server communication links. + * + * @param value the value value to set. + * @return the ServerCommunicationLinkListResult object itself. + */ + public ServerCommunicationLinkListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinks.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinks.java new file mode 100644 index 0000000000000..18e7ddec72e30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinks.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerCommunicationLinks. */ +public interface ServerCommunicationLinks { + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 serverName, String communicationLinkName); + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 serverName, String communicationLinkName, Context context); + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 server communication link. + */ + ServerCommunicationLink get(String resourceGroupName, String serverName, String communicationLinkName); + + /** + * Returns a server communication link. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param communicationLinkName The name of the server communication link. + * @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 server communication link. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context); + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server communication links. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server communication links. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Returns a server communication link. + * + * @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 server communication link. + */ + ServerCommunicationLink getById(String id); + + /** + * Returns a server communication link. + * + * @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 server communication link. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server communication link. + * + * @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 server communication link. + * + * @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 ServerCommunicationLink resource. + * + * @param name resource name. + * @return the first stage of the new ServerCommunicationLink definition. + */ + ServerCommunicationLink.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.java new file mode 100644 index 0000000000000..e950b20eaf5f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerConnectionPolicies. */ +public interface ServerConnectionPolicies { + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @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 server's secure connection policy. + */ + ServerConnectionPolicy get(String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName); + + /** + * Gets the server's secure connection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param connectionPolicyName The name of the connection policy. + * @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 server's secure connection policy. + */ + Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context); + + /** + * Gets the server's secure connection policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's secure connection policy. + */ + ServerConnectionPolicy getById(String id); + + /** + * Gets the server's secure connection policy. + * + * @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 server's secure connection policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerConnectionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ServerConnectionPolicy definition. + */ + ServerConnectionPolicy.DefinitionStages.Blank define(ConnectionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicy.java new file mode 100644 index 0000000000000..7f799c6c0aac8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicy.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; + +/** An immutable client-side representation of ServerConnectionPolicy. */ +public interface ServerConnectionPolicy { + /** + * 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 kind property: Metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the connectionType property: The server connection type. + * + * @return the connectionType value. + */ + ServerConnectionType connectionType(); + + /** + * 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.sql.generated.fluent.models.ServerConnectionPolicyInner object. + * + * @return the inner object. + */ + ServerConnectionPolicyInner innerModel(); + + /** The entirety of the ServerConnectionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerConnectionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerConnectionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerConnectionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerConnectionPolicy 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.WithConnectionType { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerConnectionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerConnectionPolicy create(Context context); + } + /** The stage of the ServerConnectionPolicy definition allowing to specify connectionType. */ + interface WithConnectionType { + /** + * Specifies the connectionType property: The server connection type.. + * + * @param connectionType The server connection type. + * @return the next definition stage. + */ + WithCreate withConnectionType(ServerConnectionType connectionType); + } + } + /** + * Begins update for the ServerConnectionPolicy resource. + * + * @return the stage of resource update. + */ + ServerConnectionPolicy.Update update(); + + /** The template for ServerConnectionPolicy update. */ + interface Update extends UpdateStages.WithConnectionType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerConnectionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerConnectionPolicy apply(Context context); + } + /** The ServerConnectionPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerConnectionPolicy update allowing to specify connectionType. */ + interface WithConnectionType { + /** + * Specifies the connectionType property: The server connection type.. + * + * @param connectionType The server connection type. + * @return the next definition stage. + */ + Update withConnectionType(ServerConnectionType connectionType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerConnectionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerConnectionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.java new file mode 100644 index 0000000000000..82b0212f772cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ServerConnectionType. */ +public enum ServerConnectionType { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Proxy. */ + PROXY("Proxy"), + + /** Enum value Redirect. */ + REDIRECT("Redirect"); + + /** The actual serialized value for a ServerConnectionType instance. */ + private final String value; + + ServerConnectionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServerConnectionType instance. + * + * @param value the serialized value to parse. + * @return the parsed ServerConnectionType object, or null if unable to parse. + */ + @JsonCreator + public static ServerConnectionType fromString(String value) { + ServerConnectionType[] items = ServerConnectionType.values(); + for (ServerConnectionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettings.java new file mode 100644 index 0000000000000..0ff62971b51fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettings.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerDevOpsAuditSettings. */ +public interface ServerDevOpsAuditSettings { + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @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 server's DevOps audit settings. + */ + ServerDevOpsAuditingSettings get(String resourceGroupName, String serverName, String devOpsAuditingSettingsName); + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The name of the devops audit settings. This should always be 'default'. + * @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 server's DevOps audit settings. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String devOpsAuditingSettingsName, Context context); + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server DevOps audit settings. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists DevOps audit settings of a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server DevOps audit settings. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a server's DevOps audit settings. + * + * @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 server's DevOps audit settings. + */ + ServerDevOpsAuditingSettings getById(String id); + + /** + * Gets a server's DevOps audit settings. + * + * @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 server's DevOps audit settings. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerDevOpsAuditingSettings resource. + * + * @param name resource name. + * @return the first stage of the new ServerDevOpsAuditingSettings definition. + */ + ServerDevOpsAuditingSettings.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.java new file mode 100644 index 0000000000000..f4b9bddf8a432 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server DevOps audit settings. */ +@Immutable +public final class ServerDevOpsAuditSettingsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerDevOpsAuditSettingsListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditingSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditingSettings.java new file mode 100644 index 0000000000000..cd016b6fabd3b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditingSettings.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import java.util.UUID; + +/** An immutable client-side representation of ServerDevOpsAuditingSettings. */ +public interface ServerDevOpsAuditingSettings { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of ServerDevOpsAuditSettingsResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the isAzureMonitorTargetEnabled property: Specifies whether DevOps audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as + * true. + * + *

When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) or + * [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner object. + * + * @return the inner object. + */ + ServerDevOpsAuditingSettingsInner innerModel(); + + /** The entirety of the ServerDevOpsAuditingSettings definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerDevOpsAuditingSettings definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerDevOpsAuditingSettings definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerDevOpsAuditingSettings 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.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerDevOpsAuditingSettings create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerDevOpsAuditingSettings create(Context context); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether DevOps audit events are sent to + * Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and + * 'IsAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether DevOps audit events are sent to Azure Monitor. In + * order to send the events to Azure Monitor, specify 'State' as 'Enabled' and + * 'IsAzureMonitorTargetEnabled' as true. + *

When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** + * The stage of the ServerDevOpsAuditingSettings definition allowing to specify storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Begins update for the ServerDevOpsAuditingSettings resource. + * + * @return the stage of resource update. + */ + ServerDevOpsAuditingSettings.Update update(); + + /** The template for ServerDevOpsAuditingSettings update. */ + interface Update + extends UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerDevOpsAuditingSettings apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerDevOpsAuditingSettings apply(Context context); + } + /** The ServerDevOpsAuditingSettings update stages. */ + interface UpdateStages { + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether DevOps audit events are sent to + * Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and + * 'IsAzureMonitorTargetEnabled' as true. + * + *

When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) . + * + * @param isAzureMonitorTargetEnabled Specifies whether DevOps audit events are sent to Azure Monitor. In + * order to send the events to Azure Monitor, specify 'State' as 'Enabled' and + * 'IsAzureMonitorTargetEnabled' as true. + *

When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + *

For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * @return the next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerDevOpsAuditingSettings refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerDevOpsAuditingSettings refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAlias.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAlias.java new file mode 100644 index 0000000000000..4082a0195e7cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAlias.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; + +/** An immutable client-side representation of ServerDnsAlias. */ +public interface ServerDnsAlias { + /** + * 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 azureDnsRecord property: The fully qualified DNS record for alias. + * + * @return the azureDnsRecord value. + */ + String azureDnsRecord(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner object. + * + * @return the inner object. + */ + ServerDnsAliasInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.java new file mode 100644 index 0000000000000..a774cbe93ed0f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.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.sql.generated.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; + +/** A server DNS alias acquisition request. */ +@Fluent +public final class ServerDnsAliasAcquisition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerDnsAliasAcquisition.class); + + /* + * The id of the server alias that will be acquired to point to this server + * instead. + */ + @JsonProperty(value = "oldServerDnsAliasId") + private String oldServerDnsAliasId; + + /** + * Get the oldServerDnsAliasId property: The id of the server alias that will be acquired to point to this server + * instead. + * + * @return the oldServerDnsAliasId value. + */ + public String oldServerDnsAliasId() { + return this.oldServerDnsAliasId; + } + + /** + * Set the oldServerDnsAliasId property: The id of the server alias that will be acquired to point to this server + * instead. + * + * @param oldServerDnsAliasId the oldServerDnsAliasId value to set. + * @return the ServerDnsAliasAcquisition object itself. + */ + public ServerDnsAliasAcquisition withOldServerDnsAliasId(String oldServerDnsAliasId) { + this.oldServerDnsAliasId = oldServerDnsAliasId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.java new file mode 100644 index 0000000000000..0355732bac954 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server DNS aliases. */ +@Immutable +public final class ServerDnsAliasListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerDnsAliasListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.java new file mode 100644 index 0000000000000..31f3be79227c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerDnsAliases. */ +public interface ServerDnsAliases { + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + ServerDnsAlias get(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + ServerDnsAlias createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 server DNS alias. + */ + ServerDnsAlias createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 serverName, String dnsAliasName); + + /** + * Deletes the server DNS alias with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server DNS aliases for a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters); + + /** + * Acquires server DNS alias from another server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param parameters A server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.java new file mode 100644 index 0000000000000..59edfe3ab197b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Server info for the server trust group. */ +@Fluent +public final class ServerInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerInfo.class); + + /* + * Server Id. + */ + @JsonProperty(value = "serverId", required = true) + private String serverId; + + /** + * Get the serverId property: Server Id. + * + * @return the serverId value. + */ + public String serverId() { + return this.serverId; + } + + /** + * Set the serverId property: Server Id. + * + * @param serverId the serverId value to set. + * @return the ServerInfo object itself. + */ + public ServerInfo withServerId(String serverId) { + this.serverId = serverId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property serverId in model ServerInfo")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.java new file mode 100644 index 0000000000000..d8a6942372c82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerKey. */ +public interface ServerKey { + /** + * 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 kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the subregion property: Subregion of the server key. + * + * @return the subregion value. + */ + String subregion(); + + /** + * Gets the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the server key. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the creationDate property: The server key creation date. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * 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.sql.generated.fluent.models.ServerKeyInner object. + * + * @return the inner object. + */ + ServerKeyInner innerModel(); + + /** The entirety of the ServerKey definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerKey definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerKey definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerKey definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerKey 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.WithKind, + DefinitionStages.WithServerKeyType, + DefinitionStages.WithUri, + DefinitionStages.WithThumbprint, + DefinitionStages.WithCreationDate { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerKey create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerKey create(Context context); + } + /** The stage of the ServerKey definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Kind of encryption protector. This is metadata used for the Azure portal + * experience.. + * + * @param kind Kind of encryption protector. This is metadata used for the Azure portal experience. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + /** The stage of the ServerKey definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'.. + * + * @param serverKeyType The server key type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ServerKey definition allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the server key.. + * + * @param uri The URI of the server key. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + /** The stage of the ServerKey definition allowing to specify thumbprint. */ + interface WithThumbprint { + /** + * Specifies the thumbprint property: Thumbprint of the server key.. + * + * @param thumbprint Thumbprint of the server key. + * @return the next definition stage. + */ + WithCreate withThumbprint(String thumbprint); + } + /** The stage of the ServerKey definition allowing to specify creationDate. */ + interface WithCreationDate { + /** + * Specifies the creationDate property: The server key creation date.. + * + * @param creationDate The server key creation date. + * @return the next definition stage. + */ + WithCreate withCreationDate(OffsetDateTime creationDate); + } + } + /** + * Begins update for the ServerKey resource. + * + * @return the stage of resource update. + */ + ServerKey.Update update(); + + /** The template for ServerKey update. */ + interface Update + extends UpdateStages.WithKind, + UpdateStages.WithServerKeyType, + UpdateStages.WithUri, + UpdateStages.WithThumbprint, + UpdateStages.WithCreationDate { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerKey apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerKey apply(Context context); + } + /** The ServerKey update stages. */ + interface UpdateStages { + /** The stage of the ServerKey update allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Kind of encryption protector. This is metadata used for the Azure portal + * experience.. + * + * @param kind Kind of encryption protector. This is metadata used for the Azure portal experience. + * @return the next definition stage. + */ + Update withKind(String kind); + } + /** The stage of the ServerKey update allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'.. + * + * @param serverKeyType The server key type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + Update withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ServerKey update allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the server key.. + * + * @param uri The URI of the server key. + * @return the next definition stage. + */ + Update withUri(String uri); + } + /** The stage of the ServerKey update allowing to specify thumbprint. */ + interface WithThumbprint { + /** + * Specifies the thumbprint property: Thumbprint of the server key.. + * + * @param thumbprint Thumbprint of the server key. + * @return the next definition stage. + */ + Update withThumbprint(String thumbprint); + } + /** The stage of the ServerKey update allowing to specify creationDate. */ + interface WithCreationDate { + /** + * Specifies the creationDate property: The server key creation date.. + * + * @param creationDate The server key creation date. + * @return the next definition stage. + */ + Update withCreationDate(OffsetDateTime creationDate); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerKey refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerKey refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.java new file mode 100644 index 0000000000000..6f0c4bfb5f462 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server keys. */ +@Immutable +public final class ServerKeyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerKeyListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyType.java new file mode 100644 index 0000000000000..9a2da17e5b3de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerKeyType. */ +public final class ServerKeyType extends ExpandableStringEnum { + /** Static value ServiceManaged for ServerKeyType. */ + public static final ServerKeyType SERVICE_MANAGED = fromString("ServiceManaged"); + + /** Static value AzureKeyVault for ServerKeyType. */ + public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates or finds a ServerKeyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerKeyType. + */ + @JsonCreator + public static ServerKeyType fromString(String name) { + return fromString(name, ServerKeyType.class); + } + + /** @return known ServerKeyType values. */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeys.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeys.java new file mode 100644 index 0000000000000..6496f7531c900 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeys.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerKeys. */ +public interface ServerKeys { + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of server keys. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of server keys. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @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 server key. + */ + ServerKey get(String resourceGroupName, String serverName, String keyName); + + /** + * Gets a server key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be retrieved. + * @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 server key. + */ + Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @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 serverName, String keyName); + + /** + * Deletes the server key with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param keyName The name of the server key to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Gets a server key. + * + * @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 server key. + */ + ServerKey getById(String id); + + /** + * Gets a server key. + * + * @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 server key. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the server key with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the server key with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerKey resource. + * + * @param name resource name. + * @return the first stage of the new ServerKey definition. + */ + ServerKey.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.java new file mode 100644 index 0000000000000..1fdad3fc98c68 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of servers. */ +@Immutable +public final class ServerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.java new file mode 100644 index 0000000000000..bb1a93948aa41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** A private endpoint connection under a server. */ +@Immutable +public final class ServerPrivateEndpointConnection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPrivateEndpointConnection.class); + + /* + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Private endpoint connection properties + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProperties properties; + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the properties property: Private endpoint connection properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPublicNetworkAccess.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPublicNetworkAccess.java new file mode 100644 index 0000000000000..1d656eaad6484 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPublicNetworkAccess.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerPublicNetworkAccess. */ +public final class ServerPublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for ServerPublicNetworkAccess. */ + public static final ServerPublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for ServerPublicNetworkAccess. */ + public static final ServerPublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ServerPublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerPublicNetworkAccess. + */ + @JsonCreator + public static ServerPublicNetworkAccess fromString(String name) { + return fromString(name, ServerPublicNetworkAccess.class); + } + + /** @return known ServerPublicNetworkAccess values. */ + public static Collection values() { + return values(ServerPublicNetworkAccess.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..72584f1aae559 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServerSecurityAlertPolicies. */ +public interface ServerSecurityAlertPolicies { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, + Context context); + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 the server's threat detection policies. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server's threat detection policies. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Get a server's security alert policy. + * + * @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 server's security alert policy. + */ + ServerSecurityAlertPolicy getById(String id); + + /** + * Get a server's security alert policy. + * + * @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 server's security alert policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ServerSecurityAlertPolicy definition. + */ + ServerSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyNameAutoGenerated name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..8d519b11be69f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ServerSecurityAlertPolicy. */ +public interface ServerSecurityAlertPolicy { + /** + * 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 state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner object. + * + * @return the inner object. + */ + ServerSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ServerSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerSecurityAlertPolicy 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.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerSecurityAlertPolicy create(Context context); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ServerSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ServerSecurityAlertPolicy.Update update(); + + /** The template for ServerSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(Context context); + } + /** The ServerSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + Update withState(SecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroup.java new file mode 100644 index 0000000000000..d7c14eadf33f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroup.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import java.util.List; + +/** An immutable client-side representation of ServerTrustGroup. */ +public interface ServerTrustGroup { + /** + * 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 groupMembers property: Group members information for the server trust group. + * + * @return the groupMembers value. + */ + List groupMembers(); + + /** + * Gets the trustScopes property: Trust scope of the server trust group. + * + * @return the trustScopes value. + */ + List trustScopes(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner object. + * + * @return the inner object. + */ + ServerTrustGroupInner innerModel(); + + /** The entirety of the ServerTrustGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerTrustGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerTrustGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerTrustGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, locationName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String resourceGroupName, String locationName); + } + /** + * The stage of the ServerTrustGroup 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.WithGroupMembers, DefinitionStages.WithTrustScopes { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerTrustGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerTrustGroup create(Context context); + } + /** The stage of the ServerTrustGroup definition allowing to specify groupMembers. */ + interface WithGroupMembers { + /** + * Specifies the groupMembers property: Group members information for the server trust group.. + * + * @param groupMembers Group members information for the server trust group. + * @return the next definition stage. + */ + WithCreate withGroupMembers(List groupMembers); + } + /** The stage of the ServerTrustGroup definition allowing to specify trustScopes. */ + interface WithTrustScopes { + /** + * Specifies the trustScopes property: Trust scope of the server trust group.. + * + * @param trustScopes Trust scope of the server trust group. + * @return the next definition stage. + */ + WithCreate withTrustScopes(List trustScopes); + } + } + /** + * Begins update for the ServerTrustGroup resource. + * + * @return the stage of resource update. + */ + ServerTrustGroup.Update update(); + + /** The template for ServerTrustGroup update. */ + interface Update extends UpdateStages.WithGroupMembers, UpdateStages.WithTrustScopes { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerTrustGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerTrustGroup apply(Context context); + } + /** The ServerTrustGroup update stages. */ + interface UpdateStages { + /** The stage of the ServerTrustGroup update allowing to specify groupMembers. */ + interface WithGroupMembers { + /** + * Specifies the groupMembers property: Group members information for the server trust group.. + * + * @param groupMembers Group members information for the server trust group. + * @return the next definition stage. + */ + Update withGroupMembers(List groupMembers); + } + /** The stage of the ServerTrustGroup update allowing to specify trustScopes. */ + interface WithTrustScopes { + /** + * Specifies the trustScopes property: Trust scope of the server trust group.. + * + * @param trustScopes Trust scope of the server trust group. + * @return the next definition stage. + */ + Update withTrustScopes(List trustScopes); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerTrustGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerTrustGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.java new file mode 100644 index 0000000000000..79f61f9e38933 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server trust groups. */ +@Immutable +public final class ServerTrustGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerTrustGroupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroups.java new file mode 100644 index 0000000000000..04521acab0f9c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroups.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.sql.generated.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 ServerTrustGroups. */ +public interface ServerTrustGroups { + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + ServerTrustGroup get(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Gets a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Deletes a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * Lists a server trust group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName, Context context); + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server trust groups by instance name. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a server trust groups by instance name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @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 server trust groups by instance name. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a server trust group. + * + * @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 server trust group. + */ + ServerTrustGroup getById(String id); + + /** + * Gets a server trust group. + * + * @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 server trust group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server trust group. + * + * @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 server trust group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerTrustGroup resource. + * + * @param name resource name. + * @return the first stage of the new ServerTrustGroup definition. + */ + ServerTrustGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java new file mode 100644 index 0000000000000..f10d77d8f8991 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An update request for an Azure SQL Database server. */ +@JsonFlatten +@Fluent +public class ServerUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The version of the server. + */ + @JsonProperty(value = "properties.version") + private String version; + + /* + * The state of the server. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * List of private endpoint connections on a server + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "properties.minimalTlsVersion") + private String minimalTlsVersion; + + /* + * Whether or not public endpoint access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private ServerPublicNetworkAccess publicNetworkAccess; + + /** + * 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 ServerUpdate object itself. + */ + public ServerUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version property: The version of the server. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the server. + * + * @param version the version value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state property: The state of the server. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public ServerPublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withPublicNetworkAccess(ServerPublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsage.java new file mode 100644 index 0000000000000..540e09a6336a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsage.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerUsage. */ +public interface ServerUsage { + /** + * Gets the name property: Name of the server usage metric. + * + * @return the name value. + */ + String name(); + + /** + * Gets the resourceName property: The name of the resource. + * + * @return the resourceName value. + */ + String resourceName(); + + /** + * Gets the displayName property: The metric display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the currentValue property: The current value of the metric. + * + * @return the currentValue value. + */ + Double currentValue(); + + /** + * Gets the limit property: The current limit of the metric. + * + * @return the limit value. + */ + Double limit(); + + /** + * Gets the unit property: The units of the metric. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the nextResetTime property: The next reset time for the metric (ISO8601 format). + * + * @return the nextResetTime value. + */ + OffsetDateTime nextResetTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner object. + * + * @return the inner object. + */ + ServerUsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.java new file mode 100644 index 0000000000000..f547fb3f32e48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list server metrics request. */ +@Fluent +public final class ServerUsageListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerUsageListResult.class); + + /* + * The list of server metrics for the server. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of server metrics for the server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server metrics for the server. + * + * @param value the value value to set. + * @return the ServerUsageListResult object itself. + */ + public ServerUsageListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ServerUsageListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.java new file mode 100644 index 0000000000000..4575e142064c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ServerUsages. */ +public interface ServerUsages { + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns server usages. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a list server metrics request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.java new file mode 100644 index 0000000000000..4bf0792e99132 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** The server capability. */ +@Fluent +public final class ServerVersionCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVersionCapability.class); + + /* + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The list of supported database editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /* + * The list of supported elastic pool editions. + */ + @JsonProperty(value = "supportedElasticPoolEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolEditions; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the name property: The server version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedEditions property: The list of supported database editions. + * + * @return the supportedEditions value. + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the supportedElasticPoolEditions property: The list of supported elastic pool editions. + * + * @return the supportedElasticPoolEditions value. + */ + public List supportedElasticPoolEditions() { + return this.supportedElasticPoolEditions; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ServerVersionCapability object itself. + */ + public ServerVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedEditions() != null) { + supportedEditions().forEach(e -> e.validate()); + } + if (supportedElasticPoolEditions() != null) { + supportedElasticPoolEditions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.java new file mode 100644 index 0000000000000..c12878432a841 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; + +/** An immutable client-side representation of ServerVulnerabilityAssessment. */ +public interface ServerVulnerabilityAssessment { + /** + * 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 storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * Gets the storageContainerSasKey property: A shared access signature (SAS Key) that has read and write access to + * the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. + * + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner object. + * + * @return the inner object. + */ + ServerVulnerabilityAssessmentInner innerModel(); + + /** The entirety of the ServerVulnerabilityAssessment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerVulnerabilityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerVulnerabilityAssessment definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerVulnerabilityAssessment 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.WithStorageContainerPath, + DefinitionStages.WithStorageContainerSasKey, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRecurringScans { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerVulnerabilityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerVulnerabilityAssessment create(Context context); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has read and + * write access to the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the + * blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Begins update for the ServerVulnerabilityAssessment resource. + * + * @return the stage of resource update. + */ + ServerVulnerabilityAssessment.Update update(); + + /** The template for ServerVulnerabilityAssessment update. */ + interface Update + extends UpdateStages.WithStorageContainerPath, + UpdateStages.WithStorageContainerSasKey, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRecurringScans { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerVulnerabilityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerVulnerabilityAssessment apply(Context context); + } + /** The ServerVulnerabilityAssessment update stages. */ + interface UpdateStages { + /** The stage of the ServerVulnerabilityAssessment update allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + Update withStorageContainerPath(String storageContainerPath); + } + /** The stage of the ServerVulnerabilityAssessment update allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has read and + * write access to the blob container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has read and write access to the + * blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the ServerVulnerabilityAssessment update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerVulnerabilityAssessment update allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerVulnerabilityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerVulnerabilityAssessment refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.java new file mode 100644 index 0000000000000..7c5497dae678b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's vulnerability assessments. */ +@Immutable +public final class ServerVulnerabilityAssessmentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVulnerabilityAssessmentListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessments.java new file mode 100644 index 0000000000000..4d53d6bad63fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessments.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.sql.generated.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 ServerVulnerabilityAssessments. */ +public interface ServerVulnerabilityAssessments { + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 server's vulnerability assessment. + */ + ServerVulnerabilityAssessment get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 server's vulnerability assessment. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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 serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of the server's vulnerability assessments. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists the vulnerability assessment policies associated with a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of the server's vulnerability assessments. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets the server's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment. + */ + ServerVulnerabilityAssessment getById(String id); + + /** + * Gets the server's vulnerability assessment. + * + * @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 server's vulnerability assessment. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the server's vulnerability assessment. + * + * @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); + + /** + * Removes the server's vulnerability assessment. + * + * @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 ServerVulnerabilityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new ServerVulnerabilityAssessment definition. + */ + ServerVulnerabilityAssessment.DefinitionStages.Blank define(VulnerabilityAssessmentName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.java new file mode 100644 index 0000000000000..1fca4e48210a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 Servers. */ +public interface Servers { + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of servers in a resource groups. + * + * @param resourceGroupName The 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 a list of servers in a resource groups. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 server. + */ + Server getByResourceGroup(String resourceGroupName, String serverName); + + /** + * Gets a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a server. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 deleteByResourceGroup(String resourceGroupName, String serverName); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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. + */ + void delete(String resourceGroupName, String serverName, Context context); + + /** + * Gets a list of all servers in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + PagedIterable list(); + + /** + * Gets a list of all servers in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription. + */ + PagedIterable list(Context context); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest parameters); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context); + + /** + * Gets a 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 server. + */ + Server getById(String id); + + /** + * Gets a 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 a server. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a 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 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Server resource. + * + * @param name resource name. + * @return the first stage of the new Server definition. + */ + Server.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjective.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjective.java new file mode 100644 index 0000000000000..6a595d9dce279 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjective.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; + +/** An immutable client-side representation of ServiceObjective. */ +public interface ServiceObjective { + /** + * 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 serviceObjectiveName property: The name for the service objective. + * + * @return the serviceObjectiveName value. + */ + String serviceObjectiveName(); + + /** + * Gets the isDefault property: Gets whether the service level objective is the default service objective. + * + * @return the isDefault value. + */ + Boolean isDefault(); + + /** + * Gets the isSystem property: Gets whether the service level objective is a system service objective. + * + * @return the isSystem value. + */ + Boolean isSystem(); + + /** + * Gets the description property: The description for the service level objective. + * + * @return the description value. + */ + String description(); + + /** + * Gets the enabled property: Gets whether the service level objective is enabled. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner object. + * + * @return the inner object. + */ + ServiceObjectiveInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java new file mode 100644 index 0000000000000..1d8d915dcf44d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.util.UUID; + +/** The service objectives capability. */ +@Fluent +public final class ServiceObjectiveCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceObjectiveCapability.class); + + /* + * The unique ID of the service objective. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private UUID id; + + /* + * The service objective name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The list of supported maximum database sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /* + * The performance level. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /* + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /* + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /* + * The included (free) max size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /* + * Whether or not zone redundancy is supported for the service objective. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * Supported time range for auto pause delay + */ + @JsonProperty(value = "supportedAutoPauseDelay", access = JsonProperty.Access.WRITE_ONLY) + private AutoPauseDelayTimeRange supportedAutoPauseDelay; + + /* + * List of supported min capacities + */ + @JsonProperty(value = "supportedMinCapacities", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMinCapacities; + + /* + * The compute model + */ + @JsonProperty(value = "computeModel", access = JsonProperty.Access.WRITE_ONLY) + private String computeModel; + + /* + * List of supported maintenance configurations + */ + @JsonProperty(value = "supportedMaintenanceConfigurations", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaintenanceConfigurations; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the id property: The unique ID of the service objective. + * + * @return the id value. + */ + public UUID id() { + return this.id; + } + + /** + * Get the name property: The service objective name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedMaxSizes property: The list of supported maximum database sizes. + * + * @return the supportedMaxSizes value. + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the performanceLevel property: The performance level. + * + * @return the performanceLevel value. + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku property: The sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the includedMaxSize property: The included (free) max size. + * + * @return the includedMaxSize value. + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the service objective. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the supportedAutoPauseDelay property: Supported time range for auto pause delay. + * + * @return the supportedAutoPauseDelay value. + */ + public AutoPauseDelayTimeRange supportedAutoPauseDelay() { + return this.supportedAutoPauseDelay; + } + + /** + * Get the supportedMinCapacities property: List of supported min capacities. + * + * @return the supportedMinCapacities value. + */ + public List supportedMinCapacities() { + return this.supportedMinCapacities; + } + + /** + * Get the computeModel property: The compute model. + * + * @return the computeModel value. + */ + public String computeModel() { + return this.computeModel; + } + + /** + * Get the supportedMaintenanceConfigurations property: List of supported maintenance configurations. + * + * @return the supportedMaintenanceConfigurations value. + */ + public List supportedMaintenanceConfigurations() { + return this.supportedMaintenanceConfigurations; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ServiceObjectiveCapability object itself. + */ + public ServiceObjectiveCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedMaxSizes() != null) { + supportedMaxSizes().forEach(e -> e.validate()); + } + if (performanceLevel() != null) { + performanceLevel().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (includedMaxSize() != null) { + includedMaxSize().validate(); + } + if (supportedAutoPauseDelay() != null) { + supportedAutoPauseDelay().validate(); + } + if (supportedMinCapacities() != null) { + supportedMinCapacities().forEach(e -> e.validate()); + } + if (supportedMaintenanceConfigurations() != null) { + supportedMaintenanceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.java new file mode 100644 index 0000000000000..a096ccccbbca1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a get database service objectives request. */ +@Fluent +public final class ServiceObjectiveListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceObjectiveListResult.class); + + /* + * The list of database service objectives. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of database service objectives. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of database service objectives. + * + * @param value the value value to set. + * @return the ServiceObjectiveListResult object itself. + */ + public ServiceObjectiveListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ServiceObjectiveListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveName.java new file mode 100644 index 0000000000000..7a965cca55c06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveName.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServiceObjectiveName. */ +public final class ServiceObjectiveName extends ExpandableStringEnum { + /** Static value System for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM = fromString("System"); + + /** Static value System0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM0 = fromString("System0"); + + /** Static value System1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM1 = fromString("System1"); + + /** Static value System2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2 = fromString("System2"); + + /** Static value System3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3 = fromString("System3"); + + /** Static value System4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4 = fromString("System4"); + + /** Static value System2L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2L = fromString("System2L"); + + /** Static value System3L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3L = fromString("System3L"); + + /** Static value System4L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4L = fromString("System4L"); + + /** Static value Free for ServiceObjectiveName. */ + public static final ServiceObjectiveName FREE = fromString("Free"); + + /** Static value Basic for ServiceObjectiveName. */ + public static final ServiceObjectiveName BASIC = fromString("Basic"); + + /** Static value S0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S0 = fromString("S0"); + + /** Static value S1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S1 = fromString("S1"); + + /** Static value S2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S2 = fromString("S2"); + + /** Static value S3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S3 = fromString("S3"); + + /** Static value S4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S4 = fromString("S4"); + + /** Static value S6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S6 = fromString("S6"); + + /** Static value S7 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S7 = fromString("S7"); + + /** Static value S9 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S9 = fromString("S9"); + + /** Static value S12 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S12 = fromString("S12"); + + /** Static value P1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P1 = fromString("P1"); + + /** Static value P2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P2 = fromString("P2"); + + /** Static value P3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P3 = fromString("P3"); + + /** Static value P4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P4 = fromString("P4"); + + /** Static value P6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P6 = fromString("P6"); + + /** Static value P11 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P11 = fromString("P11"); + + /** Static value P15 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P15 = fromString("P15"); + + /** Static value PRS1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS1 = fromString("PRS1"); + + /** Static value PRS2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS2 = fromString("PRS2"); + + /** Static value PRS4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS4 = fromString("PRS4"); + + /** Static value PRS6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS6 = fromString("PRS6"); + + /** Static value DW100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW100 = fromString("DW100"); + + /** Static value DW200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW200 = fromString("DW200"); + + /** Static value DW300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW300 = fromString("DW300"); + + /** Static value DW400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW400 = fromString("DW400"); + + /** Static value DW500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW500 = fromString("DW500"); + + /** Static value DW600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW600 = fromString("DW600"); + + /** Static value DW1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000 = fromString("DW1000"); + + /** Static value DW1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1200 = fromString("DW1200"); + + /** Static value DW1000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000C = fromString("DW1000c"); + + /** Static value DW1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500 = fromString("DW1500"); + + /** Static value DW1500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500C = fromString("DW1500c"); + + /** Static value DW2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000 = fromString("DW2000"); + + /** Static value DW2000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000C = fromString("DW2000c"); + + /** Static value DW3000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000 = fromString("DW3000"); + + /** Static value DW2500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2500C = fromString("DW2500c"); + + /** Static value DW3000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000C = fromString("DW3000c"); + + /** Static value DW6000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000 = fromString("DW6000"); + + /** Static value DW5000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW5000C = fromString("DW5000c"); + + /** Static value DW6000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000C = fromString("DW6000c"); + + /** Static value DW7500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW7500C = fromString("DW7500c"); + + /** Static value DW10000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW10000C = fromString("DW10000c"); + + /** Static value DW15000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW15000C = fromString("DW15000c"); + + /** Static value DW30000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW30000C = fromString("DW30000c"); + + /** Static value DS100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS100 = fromString("DS100"); + + /** Static value DS200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS200 = fromString("DS200"); + + /** Static value DS300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS300 = fromString("DS300"); + + /** Static value DS400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS400 = fromString("DS400"); + + /** Static value DS500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS500 = fromString("DS500"); + + /** Static value DS600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS600 = fromString("DS600"); + + /** Static value DS1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1000 = fromString("DS1000"); + + /** Static value DS1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1200 = fromString("DS1200"); + + /** Static value DS1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1500 = fromString("DS1500"); + + /** Static value DS2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS2000 = fromString("DS2000"); + + /** Static value ElasticPool for ServiceObjectiveName. */ + public static final ServiceObjectiveName ELASTIC_POOL = fromString("ElasticPool"); + + /** + * Creates or finds a ServiceObjectiveName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceObjectiveName. + */ + @JsonCreator + public static ServiceObjectiveName fromString(String name) { + return fromString(name, ServiceObjectiveName.class); + } + + /** @return known ServiceObjectiveName values. */ + public static Collection values() { + return values(ServiceObjectiveName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.java new file mode 100644 index 0000000000000..fcc012ca5a075 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServiceObjectives. */ +public interface ServiceObjectives { + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @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 database service objective. + */ + ServiceObjective get(String resourceGroupName, String serverName, String serviceObjectiveName); + + /** + * Gets a database service objective. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceObjectiveName The name of the service objective to retrieve. + * @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 database service objective. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context); + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Returns database service objectives. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 represents the response to a get database service objectives request. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisor.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisor.java new file mode 100644 index 0000000000000..24d4b521212f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisor.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceTierAdvisorInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ServiceTierAdvisor. */ +public interface ServiceTierAdvisor { + /** + * 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 observationPeriodStart property: The observation period start (ISO8601 format). + * + * @return the observationPeriodStart value. + */ + OffsetDateTime observationPeriodStart(); + + /** + * Gets the observationPeriodEnd property: The observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value. + */ + OffsetDateTime observationPeriodEnd(); + + /** + * Gets the activeTimeRatio property: The activeTimeRatio for service tier advisor. + * + * @return the activeTimeRatio value. + */ + Double activeTimeRatio(); + + /** + * Gets the minDtu property: Gets or sets minDtu for service tier advisor. + * + * @return the minDtu value. + */ + Double minDtu(); + + /** + * Gets the avgDtu property: Gets or sets avgDtu for service tier advisor. + * + * @return the avgDtu value. + */ + Double avgDtu(); + + /** + * Gets the maxDtu property: Gets or sets maxDtu for service tier advisor. + * + * @return the maxDtu value. + */ + Double maxDtu(); + + /** + * Gets the maxSizeInGB property: Gets or sets maxSizeInGB for service tier advisor. + * + * @return the maxSizeInGB value. + */ + Double maxSizeInGB(); + + /** + * Gets the serviceLevelObjectiveUsageMetrics property: Gets or sets serviceLevelObjectiveUsageMetrics for the + * service tier advisor. + * + * @return the serviceLevelObjectiveUsageMetrics value. + */ + List serviceLevelObjectiveUsageMetrics(); + + /** + * Gets the currentServiceLevelObjective property: Gets or sets currentServiceLevelObjective for service tier + * advisor. + * + * @return the currentServiceLevelObjective value. + */ + String currentServiceLevelObjective(); + + /** + * Gets the currentServiceLevelObjectiveId property: Gets or sets currentServiceLevelObjectiveId for service tier + * advisor. + * + * @return the currentServiceLevelObjectiveId value. + */ + UUID currentServiceLevelObjectiveId(); + + /** + * Gets the usageBasedRecommendationServiceLevelObjective property: Gets or sets + * usageBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjective value. + */ + String usageBasedRecommendationServiceLevelObjective(); + + /** + * Gets the usageBasedRecommendationServiceLevelObjectiveId property: Gets or sets + * usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjectiveId value. + */ + UUID usageBasedRecommendationServiceLevelObjectiveId(); + + /** + * Gets the databaseSizeBasedRecommendationServiceLevelObjective property: Gets or sets + * databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjective value. + */ + String databaseSizeBasedRecommendationServiceLevelObjective(); + + /** + * Gets the databaseSizeBasedRecommendationServiceLevelObjectiveId property: Gets or sets + * databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value. + */ + UUID databaseSizeBasedRecommendationServiceLevelObjectiveId(); + + /** + * Gets the disasterPlanBasedRecommendationServiceLevelObjective property: Gets or sets + * disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjective value. + */ + String disasterPlanBasedRecommendationServiceLevelObjective(); + + /** + * Gets the disasterPlanBasedRecommendationServiceLevelObjectiveId property: Gets or sets + * disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value. + */ + UUID disasterPlanBasedRecommendationServiceLevelObjectiveId(); + + /** + * Gets the overallRecommendationServiceLevelObjective property: Gets or sets + * overallRecommendationServiceLevelObjective for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjective value. + */ + String overallRecommendationServiceLevelObjective(); + + /** + * Gets the overallRecommendationServiceLevelObjectiveId property: Gets or sets + * overallRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjectiveId value. + */ + UUID overallRecommendationServiceLevelObjectiveId(); + + /** + * Gets the confidence property: Gets or sets confidence for service tier advisor. + * + * @return the confidence value. + */ + Double confidence(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServiceTierAdvisorInner object. + * + * @return the inner object. + */ + ServiceTierAdvisorInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisorListResult.java new file mode 100644 index 0000000000000..55f219f921907 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisorListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceTierAdvisorInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list service tier advisor request. */ +@Fluent +public final class ServiceTierAdvisorListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceTierAdvisorListResult.class); + + /* + * The list of service tier advisors for specified database. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of service tier advisors for specified database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of service tier advisors for specified database. + * + * @param value the value value to set. + * @return the ServiceTierAdvisorListResult object itself. + */ + public ServiceTierAdvisorListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ServiceTierAdvisorListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisors.java new file mode 100644 index 0000000000000..b10a29e7431ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceTierAdvisors.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 ServiceTierAdvisors. */ +public interface ServiceTierAdvisors { + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 service tier advisor. + */ + ServiceTierAdvisor get( + String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName); + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 service tier advisor. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String serviceTierAdvisorName, + Context context); + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @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 represents the response to a list service tier advisor request. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns service tier advisors for specified database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of database. + * @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 represents the response to a list service tier advisor request. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ShortTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ShortTermRetentionPolicyName.java new file mode 100644 index 0000000000000..e89ccdb0c62e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ShortTermRetentionPolicyName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ShortTermRetentionPolicyName. */ +public final class ShortTermRetentionPolicyName extends ExpandableStringEnum { + /** Static value default for ShortTermRetentionPolicyName. */ + public static final ShortTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ShortTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ShortTermRetentionPolicyName. + */ + @JsonCreator + public static ShortTermRetentionPolicyName fromString(String name) { + return fromString(name, ShortTermRetentionPolicyName.class); + } + + /** @return known ShortTermRetentionPolicyName values. */ + public static Collection values() { + return values(ShortTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.java new file mode 100644 index 0000000000000..7478122a4aeaa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** An ARM Resource SKU. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The name of the SKU, typically, a letter + Number code, e.g. P3. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The tier or edition of the particular SKU, e.g. Basic, Premium. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Size of the particular SKU + */ + @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; + + /* + * Capacity of the particular SKU. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name property: The name of the SKU, typically, a letter + Number code, e.g. P3. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU, typically, a letter + Number code, e.g. P3. + * + * @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: The tier or edition of the particular SKU, e.g. Basic, Premium. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The tier or edition of the particular SKU, e.g. Basic, Premium. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: Size of the particular SKU. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: Size of the particular SKU. + * + * @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: Capacity of the particular SKU. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Capacity of the particular SKU. + * + * @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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SloUsageMetric.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SloUsageMetric.java new file mode 100644 index 0000000000000..6af500255acbf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SloUsageMetric.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.util.UUID; + +/** A Slo Usage Metric. */ +@Immutable +public final class SloUsageMetric { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SloUsageMetric.class); + + /* + * The serviceLevelObjective for SLO usage metric. + */ + @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /* + * The serviceLevelObjectiveId for SLO usage metric. + */ + @JsonProperty(value = "serviceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID serviceLevelObjectiveId; + + /* + * Gets or sets inRangeTimeRatio for SLO usage metric. + */ + @JsonProperty(value = "inRangeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private Double inRangeTimeRatio; + + /** + * Get the serviceLevelObjective property: The serviceLevelObjective for SLO usage metric. + * + * @return the serviceLevelObjective value. + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the serviceLevelObjectiveId property: The serviceLevelObjectiveId for SLO usage metric. + * + * @return the serviceLevelObjectiveId value. + */ + public UUID serviceLevelObjectiveId() { + return this.serviceLevelObjectiveId; + } + + /** + * Get the inRangeTimeRatio property: Gets or sets inRangeTimeRatio for SLO usage metric. + * + * @return the inRangeTimeRatio value. + */ + public Double inRangeTimeRatio() { + return this.inRangeTimeRatio; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageAccountType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageAccountType.java new file mode 100644 index 0000000000000..7419132d658e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageAccountType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageAccountType. */ +public final class StorageAccountType extends ExpandableStringEnum { + /** Static value GRS for StorageAccountType. */ + public static final StorageAccountType GRS = fromString("GRS"); + + /** Static value LRS for StorageAccountType. */ + public static final StorageAccountType LRS = fromString("LRS"); + + /** Static value ZRS for StorageAccountType. */ + public static final StorageAccountType ZRS = fromString("ZRS"); + + /** + * Creates or finds a StorageAccountType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAccountType. + */ + @JsonCreator + public static StorageAccountType fromString(String name) { + return fromString(name, StorageAccountType.class); + } + + /** @return known StorageAccountType values. */ + public static Collection values() { + return values(StorageAccountType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.java new file mode 100644 index 0000000000000..d91c0c5878317 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.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.sql.generated.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 storage account type capability. */ +@Fluent +public final class StorageCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageCapability.class); + + /* + * The storage account type for the database's backups. + */ + @JsonProperty(value = "storageAccountType", access = JsonProperty.Access.WRITE_ONLY) + private StorageCapabilityStorageAccountType storageAccountType; + + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the storageAccountType property: The storage account type for the database's backups. + * + * @return the storageAccountType value. + */ + public StorageCapabilityStorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the StorageCapability object itself. + */ + public StorageCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapabilityStorageAccountType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapabilityStorageAccountType.java new file mode 100644 index 0000000000000..3557120eb4b30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapabilityStorageAccountType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageCapabilityStorageAccountType. */ +public final class StorageCapabilityStorageAccountType + extends ExpandableStringEnum { + /** Static value GRS for StorageCapabilityStorageAccountType. */ + public static final StorageCapabilityStorageAccountType GRS = fromString("GRS"); + + /** Static value LRS for StorageCapabilityStorageAccountType. */ + public static final StorageCapabilityStorageAccountType LRS = fromString("LRS"); + + /** Static value ZRS for StorageCapabilityStorageAccountType. */ + public static final StorageCapabilityStorageAccountType ZRS = fromString("ZRS"); + + /** + * Creates or finds a StorageCapabilityStorageAccountType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageCapabilityStorageAccountType. + */ + @JsonCreator + public static StorageCapabilityStorageAccountType fromString(String name) { + return fromString(name, StorageCapabilityStorageAccountType.class); + } + + /** @return known StorageCapabilityStorageAccountType values. */ + public static Collection values() { + return values(StorageCapabilityStorageAccountType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageKeyType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageKeyType.java new file mode 100644 index 0000000000000..1c4946e8dd946 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageKeyType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageKeyType. */ +public final class StorageKeyType extends ExpandableStringEnum { + /** Static value SharedAccessKey for StorageKeyType. */ + public static final StorageKeyType SHARED_ACCESS_KEY = fromString("SharedAccessKey"); + + /** Static value StorageAccessKey for StorageKeyType. */ + public static final StorageKeyType STORAGE_ACCESS_KEY = fromString("StorageAccessKey"); + + /** + * Creates or finds a StorageKeyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageKeyType. + */ + @JsonCreator + public static StorageKeyType fromString(String name) { + return fromString(name, StorageKeyType.class); + } + + /** @return known StorageKeyType values. */ + public static Collection values() { + return values(StorageKeyType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsage.java new file mode 100644 index 0000000000000..2ef4d388b44ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; + +/** An immutable client-side representation of SubscriptionUsage. */ +public interface SubscriptionUsage { + /** + * 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 displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + Double currentValue(); + + /** + * Gets the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + Double limit(); + + /** + * Gets the unit property: Unit of the metric. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner object. + * + * @return the inner object. + */ + SubscriptionUsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.java new file mode 100644 index 0000000000000..f7a02fb628d5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of subscription usage metrics in a location. */ +@Immutable +public final class SubscriptionUsageListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubscriptionUsageListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsages.java new file mode 100644 index 0000000000000..0fe236f86eccb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsages.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.sql.generated.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 SubscriptionUsages. */ +public interface SubscriptionUsages { + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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 subscription usage metrics in a given location. + */ + PagedIterable listByLocation(String locationName); + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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 subscription usage metrics in a given location. + */ + PagedIterable listByLocation(String locationName, Context context); + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 subscription usage metric. + */ + SubscriptionUsage get(String locationName, String usageName); + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 subscription usage metric. + */ + Response getWithResponse(String locationName, String usageName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.java new file mode 100644 index 0000000000000..abcbd60eb7fa5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SyncAgent. */ +public interface SyncAgent { + /** + * 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 namePropertiesName property: Name of the sync agent. + * + * @return the namePropertiesName value. + */ + String namePropertiesName(); + + /** + * Gets the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * Gets the lastAliveTime property: Last alive time of the sync agent. + * + * @return the lastAliveTime value. + */ + OffsetDateTime lastAliveTime(); + + /** + * Gets the state property: State of the sync agent. + * + * @return the state value. + */ + SyncAgentState state(); + + /** + * Gets the isUpToDate property: If the sync agent version is up to date. + * + * @return the isUpToDate value. + */ + Boolean isUpToDate(); + + /** + * Gets the expiryTime property: Expiration time of the sync agent version. + * + * @return the expiryTime value. + */ + OffsetDateTime expiryTime(); + + /** + * Gets the version property: Version of the sync agent. + * + * @return the version value. + */ + String version(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner object. + * + * @return the inner object. + */ + SyncAgentInner innerModel(); + + /** The entirety of the SyncAgent definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SyncAgent definition stages. */ + interface DefinitionStages { + /** The first stage of the SyncAgent definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SyncAgent definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the SyncAgent 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.WithSyncDatabaseId { + /** + * Executes the create request. + * + * @return the created resource. + */ + SyncAgent create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SyncAgent create(Context context); + } + /** The stage of the SyncAgent definition allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync agent.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @return the next definition stage. + */ + WithCreate withSyncDatabaseId(String syncDatabaseId); + } + } + /** + * Begins update for the SyncAgent resource. + * + * @return the stage of resource update. + */ + SyncAgent.Update update(); + + /** The template for SyncAgent update. */ + interface Update extends UpdateStages.WithSyncDatabaseId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SyncAgent apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SyncAgent apply(Context context); + } + /** The SyncAgent update stages. */ + interface UpdateStages { + /** The stage of the SyncAgent update allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync agent.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @return the next definition stage. + */ + Update withSyncDatabaseId(String syncDatabaseId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SyncAgent refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SyncAgent refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentKeyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentKeyProperties.java new file mode 100644 index 0000000000000..a851f3c3d55b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentKeyProperties.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; + +/** An immutable client-side representation of SyncAgentKeyProperties. */ +public interface SyncAgentKeyProperties { + /** + * Gets the syncAgentKey property: Key of sync agent. + * + * @return the syncAgentKey value. + */ + String syncAgentKey(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner object. + * + * @return the inner object. + */ + SyncAgentKeyPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabase.java new file mode 100644 index 0000000000000..37c5db2f9ba2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabase.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; + +/** An immutable client-side representation of SyncAgentLinkedDatabase. */ +public interface SyncAgentLinkedDatabase { + /** + * 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 databaseType property: Type of the sync agent linked database. + * + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * Gets the databaseId property: Id of the sync agent linked database. + * + * @return the databaseId value. + */ + String databaseId(); + + /** + * Gets the description property: Description of the sync agent linked database. + * + * @return the description value. + */ + String description(); + + /** + * Gets the serverName property: Server name of the sync agent linked database. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the databaseName property: Database name of the sync agent linked database. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the username property: User name of the sync agent linked database. + * + * @return the username value. + */ + String username(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner object. + * + * @return the inner object. + */ + SyncAgentLinkedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.java new file mode 100644 index 0000000000000..2266aad35391f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync agent linked databases. */ +@Immutable +public final class SyncAgentLinkedDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncAgentLinkedDatabaseListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.java new file mode 100644 index 0000000000000..17acdb63fecc6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync agents. */ +@Immutable +public final class SyncAgentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncAgentListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentState.java new file mode 100644 index 0000000000000..e6b64dcf23fe1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncAgentState. */ +public final class SyncAgentState extends ExpandableStringEnum { + /** Static value Online for SyncAgentState. */ + public static final SyncAgentState ONLINE = fromString("Online"); + + /** Static value Offline for SyncAgentState. */ + public static final SyncAgentState OFFLINE = fromString("Offline"); + + /** Static value NeverConnected for SyncAgentState. */ + public static final SyncAgentState NEVER_CONNECTED = fromString("NeverConnected"); + + /** + * Creates or finds a SyncAgentState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncAgentState. + */ + @JsonCreator + public static SyncAgentState fromString(String name) { + return fromString(name, SyncAgentState.class); + } + + /** @return known SyncAgentState values. */ + public static Collection values() { + return values(SyncAgentState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgents.java new file mode 100644 index 0000000000000..8e650a0327fe5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgents.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 SyncAgents. */ +public interface SyncAgents { + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent. + */ + SyncAgent get(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Gets a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 sync agent. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 serverName, String syncAgentName); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists sync agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 properties of an Azure SQL Database sync agent key. + */ + SyncAgentKeyProperties generateKey(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 properties of an Azure SQL Database sync agent key. + */ + Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases. + */ + PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName); + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases. + */ + PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Gets a sync agent. + * + * @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 sync agent. + */ + SyncAgent getById(String id); + + /** + * Gets a sync agent. + * + * @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 sync agent. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a sync agent. + * + * @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 sync agent. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SyncAgent resource. + * + * @param name resource name. + * @return the first stage of the new SyncAgent definition. + */ + SyncAgent.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncConflictResolutionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncConflictResolutionPolicy.java new file mode 100644 index 0000000000000..b55e40c608ec4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncConflictResolutionPolicy.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncConflictResolutionPolicy. */ +public final class SyncConflictResolutionPolicy extends ExpandableStringEnum { + /** Static value HubWin for SyncConflictResolutionPolicy. */ + public static final SyncConflictResolutionPolicy HUB_WIN = fromString("HubWin"); + + /** Static value MemberWin for SyncConflictResolutionPolicy. */ + public static final SyncConflictResolutionPolicy MEMBER_WIN = fromString("MemberWin"); + + /** + * Creates or finds a SyncConflictResolutionPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncConflictResolutionPolicy. + */ + @JsonCreator + public static SyncConflictResolutionPolicy fromString(String name) { + return fromString(name, SyncConflictResolutionPolicy.class); + } + + /** @return known SyncConflictResolutionPolicy values. */ + public static Collection values() { + return values(SyncConflictResolutionPolicy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.java new file mode 100644 index 0000000000000..f4fb2da514197 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync database ID properties. */ +@Immutable +public final class SyncDatabaseIdListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncDatabaseIdListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdProperties.java new file mode 100644 index 0000000000000..f5247afba90bf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdProperties.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; + +/** An immutable client-side representation of SyncDatabaseIdProperties. */ +public interface SyncDatabaseIdProperties { + /** + * Gets the id property: ARM resource id of sync database. + * + * @return the id value. + */ + String id(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner object. + * + * @return the inner object. + */ + SyncDatabaseIdPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDirection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDirection.java new file mode 100644 index 0000000000000..2e8f4246fa00e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDirection.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncDirection. */ +public final class SyncDirection extends ExpandableStringEnum { + /** Static value Bidirectional for SyncDirection. */ + public static final SyncDirection BIDIRECTIONAL = fromString("Bidirectional"); + + /** Static value OneWayMemberToHub for SyncDirection. */ + public static final SyncDirection ONE_WAY_MEMBER_TO_HUB = fromString("OneWayMemberToHub"); + + /** Static value OneWayHubToMember for SyncDirection. */ + public static final SyncDirection ONE_WAY_HUB_TO_MEMBER = fromString("OneWayHubToMember"); + + /** + * Creates or finds a SyncDirection from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncDirection. + */ + @JsonCreator + public static SyncDirection fromString(String name) { + return fromString(name, SyncDirection.class); + } + + /** @return known SyncDirection values. */ + public static Collection values() { + return values(SyncDirection.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaProperties.java new file mode 100644 index 0000000000000..860c32c7f9bc3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaProperties.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of SyncFullSchemaProperties. */ +public interface SyncFullSchemaProperties { + /** + * Gets the tables property: List of tables in the database full schema. + * + * @return the tables value. + */ + List tables(); + + /** + * Gets the lastUpdateTime property: Last update time of the database schema. + * + * @return the lastUpdateTime value. + */ + OffsetDateTime lastUpdateTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner object. + * + * @return the inner object. + */ + SyncFullSchemaPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.java new file mode 100644 index 0000000000000..d324bacd944a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync schema properties. */ +@Immutable +public final class SyncFullSchemaPropertiesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncFullSchemaPropertiesListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.java new file mode 100644 index 0000000000000..3d7fba87a4f50 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.util.List; + +/** Properties of the table in the database full schema. */ +@Immutable +public final class SyncFullSchemaTable { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncFullSchemaTable.class); + + /* + * List of columns in the table of database full schema. + */ + @JsonProperty(value = "columns", access = JsonProperty.Access.WRITE_ONLY) + private List columns; + + /* + * Error id of the table. + */ + @JsonProperty(value = "errorId", access = JsonProperty.Access.WRITE_ONLY) + private String errorId; + + /* + * If there is error in the table. + */ + @JsonProperty(value = "hasError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasError; + + /* + * Name of the table. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Quoted name of the table. + */ + @JsonProperty(value = "quotedName", access = JsonProperty.Access.WRITE_ONLY) + private String quotedName; + + /** + * Get the columns property: List of columns in the table of database full schema. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Get the errorId property: Error id of the table. + * + * @return the errorId value. + */ + public String errorId() { + return this.errorId; + } + + /** + * Get the hasError property: If there is error in the table. + * + * @return the hasError value. + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get the name property: Name of the table. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the quotedName property: Quoted name of the table. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.java new file mode 100644 index 0000000000000..23f2ec71c13ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties of the column in the table of database full schema. */ +@Immutable +public final class SyncFullSchemaTableColumn { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncFullSchemaTableColumn.class); + + /* + * Data size of the column. + */ + @JsonProperty(value = "dataSize", access = JsonProperty.Access.WRITE_ONLY) + private String dataSize; + + /* + * Data type of the column. + */ + @JsonProperty(value = "dataType", access = JsonProperty.Access.WRITE_ONLY) + private String dataType; + + /* + * Error id of the column. + */ + @JsonProperty(value = "errorId", access = JsonProperty.Access.WRITE_ONLY) + private String errorId; + + /* + * If there is error in the table. + */ + @JsonProperty(value = "hasError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasError; + + /* + * If it is the primary key of the table. + */ + @JsonProperty(value = "isPrimaryKey", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isPrimaryKey; + + /* + * Name of the column. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Quoted name of the column. + */ + @JsonProperty(value = "quotedName", access = JsonProperty.Access.WRITE_ONLY) + private String quotedName; + + /** + * Get the dataSize property: Data size of the column. + * + * @return the dataSize value. + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Get the dataType property: Data type of the column. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Get the errorId property: Error id of the column. + * + * @return the errorId value. + */ + public String errorId() { + return this.errorId; + } + + /** + * Get the hasError property: If there is error in the table. + * + * @return the hasError value. + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get the isPrimaryKey property: If it is the primary key of the table. + * + * @return the isPrimaryKey value. + */ + public Boolean isPrimaryKey() { + return this.isPrimaryKey; + } + + /** + * Get the name property: Name of the column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the quotedName property: Quoted name of the column. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.java new file mode 100644 index 0000000000000..7b5a66d2c499f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SyncGroup. */ +public interface SyncGroup { + /** + * 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 interval property: Sync interval of the sync group. + * + * @return the interval value. + */ + Integer interval(); + + /** + * Gets the lastSyncTime property: Last sync time of the sync group. + * + * @return the lastSyncTime value. + */ + OffsetDateTime lastSyncTime(); + + /** + * Gets the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @return the conflictResolutionPolicy value. + */ + SyncConflictResolutionPolicy conflictResolutionPolicy(); + + /** + * Gets the syncDatabaseId property: ARM resource id of the sync database in the sync group. + * + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * Gets the hubDatabaseUsername property: User name for the sync group hub database credential. + * + * @return the hubDatabaseUsername value. + */ + String hubDatabaseUsername(); + + /** + * Gets the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @return the hubDatabasePassword value. + */ + String hubDatabasePassword(); + + /** + * Gets the syncState property: Sync state of the sync group. + * + * @return the syncState value. + */ + SyncGroupState syncState(); + + /** + * Gets the schema property: Sync schema of the sync group. + * + * @return the schema value. + */ + SyncGroupSchema schema(); + + /** + * Gets the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @return the usePrivateLinkConnection value. + */ + Boolean usePrivateLinkConnection(); + + /** + * Gets the privateEndpointName property: Private endpoint name of the sync group if use private link connection is + * enabled. + * + * @return the privateEndpointName value. + */ + String privateEndpointName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner object. + * + * @return the inner object. + */ + SyncGroupInner innerModel(); + + /** The entirety of the SyncGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SyncGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the SyncGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SyncGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the SyncGroup 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.WithInterval, + DefinitionStages.WithConflictResolutionPolicy, + DefinitionStages.WithSyncDatabaseId, + DefinitionStages.WithHubDatabaseUsername, + DefinitionStages.WithHubDatabasePassword, + DefinitionStages.WithSchema, + DefinitionStages.WithUsePrivateLinkConnection { + /** + * Executes the create request. + * + * @return the created resource. + */ + SyncGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SyncGroup create(Context context); + } + /** The stage of the SyncGroup definition allowing to specify interval. */ + interface WithInterval { + /** + * Specifies the interval property: Sync interval of the sync group.. + * + * @param interval Sync interval of the sync group. + * @return the next definition stage. + */ + WithCreate withInterval(Integer interval); + } + /** The stage of the SyncGroup definition allowing to specify conflictResolutionPolicy. */ + interface WithConflictResolutionPolicy { + /** + * Specifies the conflictResolutionPolicy property: Conflict resolution policy of the sync group.. + * + * @param conflictResolutionPolicy Conflict resolution policy of the sync group. + * @return the next definition stage. + */ + WithCreate withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + /** The stage of the SyncGroup definition allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync group.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync group. + * @return the next definition stage. + */ + WithCreate withSyncDatabaseId(String syncDatabaseId); + } + /** The stage of the SyncGroup definition allowing to specify hubDatabaseUsername. */ + interface WithHubDatabaseUsername { + /** + * Specifies the hubDatabaseUsername property: User name for the sync group hub database credential.. + * + * @param hubDatabaseUsername User name for the sync group hub database credential. + * @return the next definition stage. + */ + WithCreate withHubDatabaseUsername(String hubDatabaseUsername); + } + /** The stage of the SyncGroup definition allowing to specify hubDatabasePassword. */ + interface WithHubDatabasePassword { + /** + * Specifies the hubDatabasePassword property: Password for the sync group hub database credential.. + * + * @param hubDatabasePassword Password for the sync group hub database credential. + * @return the next definition stage. + */ + WithCreate withHubDatabasePassword(String hubDatabasePassword); + } + /** The stage of the SyncGroup definition allowing to specify schema. */ + interface WithSchema { + /** + * Specifies the schema property: Sync schema of the sync group.. + * + * @param schema Sync schema of the sync group. + * @return the next definition stage. + */ + WithCreate withSchema(SyncGroupSchema schema); + } + /** The stage of the SyncGroup definition allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: If use private link connection is enabled.. + * + * @param usePrivateLinkConnection If use private link connection is enabled. + * @return the next definition stage. + */ + WithCreate withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + } + /** + * Begins update for the SyncGroup resource. + * + * @return the stage of resource update. + */ + SyncGroup.Update update(); + + /** The template for SyncGroup update. */ + interface Update + extends UpdateStages.WithInterval, + UpdateStages.WithConflictResolutionPolicy, + UpdateStages.WithSyncDatabaseId, + UpdateStages.WithHubDatabaseUsername, + UpdateStages.WithHubDatabasePassword, + UpdateStages.WithSchema, + UpdateStages.WithUsePrivateLinkConnection { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SyncGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SyncGroup apply(Context context); + } + /** The SyncGroup update stages. */ + interface UpdateStages { + /** The stage of the SyncGroup update allowing to specify interval. */ + interface WithInterval { + /** + * Specifies the interval property: Sync interval of the sync group.. + * + * @param interval Sync interval of the sync group. + * @return the next definition stage. + */ + Update withInterval(Integer interval); + } + /** The stage of the SyncGroup update allowing to specify conflictResolutionPolicy. */ + interface WithConflictResolutionPolicy { + /** + * Specifies the conflictResolutionPolicy property: Conflict resolution policy of the sync group.. + * + * @param conflictResolutionPolicy Conflict resolution policy of the sync group. + * @return the next definition stage. + */ + Update withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + /** The stage of the SyncGroup update allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync group.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync group. + * @return the next definition stage. + */ + Update withSyncDatabaseId(String syncDatabaseId); + } + /** The stage of the SyncGroup update allowing to specify hubDatabaseUsername. */ + interface WithHubDatabaseUsername { + /** + * Specifies the hubDatabaseUsername property: User name for the sync group hub database credential.. + * + * @param hubDatabaseUsername User name for the sync group hub database credential. + * @return the next definition stage. + */ + Update withHubDatabaseUsername(String hubDatabaseUsername); + } + /** The stage of the SyncGroup update allowing to specify hubDatabasePassword. */ + interface WithHubDatabasePassword { + /** + * Specifies the hubDatabasePassword property: Password for the sync group hub database credential.. + * + * @param hubDatabasePassword Password for the sync group hub database credential. + * @return the next definition stage. + */ + Update withHubDatabasePassword(String hubDatabasePassword); + } + /** The stage of the SyncGroup update allowing to specify schema. */ + interface WithSchema { + /** + * Specifies the schema property: Sync schema of the sync group.. + * + * @param schema Sync schema of the sync group. + * @return the next definition stage. + */ + Update withSchema(SyncGroupSchema schema); + } + /** The stage of the SyncGroup update allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: If use private link connection is enabled.. + * + * @param usePrivateLinkConnection If use private link connection is enabled. + * @return the next definition stage. + */ + Update withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SyncGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SyncGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.java new file mode 100644 index 0000000000000..cd0c31668cd40 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync groups. */ +@Immutable +public final class SyncGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.java new file mode 100644 index 0000000000000..23841c3e9c40c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync group log properties. */ +@Immutable +public final class SyncGroupLogListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupLogListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogProperties.java new file mode 100644 index 0000000000000..4cde7c4cee48c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogProperties.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of SyncGroupLogProperties. */ +public interface SyncGroupLogProperties { + /** + * Gets the timestamp property: Timestamp of the sync group log. + * + * @return the timestamp value. + */ + OffsetDateTime timestamp(); + + /** + * Gets the type property: Type of the sync group log. + * + * @return the type value. + */ + SyncGroupLogType type(); + + /** + * Gets the source property: Source of the sync group log. + * + * @return the source value. + */ + String source(); + + /** + * Gets the details property: Details of the sync group log. + * + * @return the details value. + */ + String details(); + + /** + * Gets the tracingId property: TracingId of the sync group log. + * + * @return the tracingId value. + */ + UUID tracingId(); + + /** + * Gets the operationStatus property: OperationStatus of the sync group log. + * + * @return the operationStatus value. + */ + String operationStatus(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner object. + * + * @return the inner object. + */ + SyncGroupLogPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogType.java new file mode 100644 index 0000000000000..436d174863965 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncGroupLogType. */ +public final class SyncGroupLogType extends ExpandableStringEnum { + /** Static value All for SyncGroupLogType. */ + public static final SyncGroupLogType ALL = fromString("All"); + + /** Static value Error for SyncGroupLogType. */ + public static final SyncGroupLogType ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupLogType. */ + public static final SyncGroupLogType WARNING = fromString("Warning"); + + /** Static value Success for SyncGroupLogType. */ + public static final SyncGroupLogType SUCCESS = fromString("Success"); + + /** + * Creates or finds a SyncGroupLogType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncGroupLogType. + */ + @JsonCreator + public static SyncGroupLogType fromString(String name) { + return fromString(name, SyncGroupLogType.class); + } + + /** @return known SyncGroupLogType values. */ + public static Collection values() { + return values(SyncGroupLogType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.java new file mode 100644 index 0000000000000..5d731505f8f68 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.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.sql.generated.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; + +/** Properties of sync group schema. */ +@Fluent +public final class SyncGroupSchema { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupSchema.class); + + /* + * List of tables in sync group schema. + */ + @JsonProperty(value = "tables") + private List tables; + + /* + * Name of master sync member where the schema is from. + */ + @JsonProperty(value = "masterSyncMemberName") + private String masterSyncMemberName; + + /** + * Get the tables property: List of tables in sync group schema. + * + * @return the tables value. + */ + public List tables() { + return this.tables; + } + + /** + * Set the tables property: List of tables in sync group schema. + * + * @param tables the tables value to set. + * @return the SyncGroupSchema object itself. + */ + public SyncGroupSchema withTables(List tables) { + this.tables = tables; + return this; + } + + /** + * Get the masterSyncMemberName property: Name of master sync member where the schema is from. + * + * @return the masterSyncMemberName value. + */ + public String masterSyncMemberName() { + return this.masterSyncMemberName; + } + + /** + * Set the masterSyncMemberName property: Name of master sync member where the schema is from. + * + * @param masterSyncMemberName the masterSyncMemberName value to set. + * @return the SyncGroupSchema object itself. + */ + public SyncGroupSchema withMasterSyncMemberName(String masterSyncMemberName) { + this.masterSyncMemberName = masterSyncMemberName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tables() != null) { + tables().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.java new file mode 100644 index 0000000000000..1e8478e1afcb2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.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.sql.generated.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; + +/** Properties of table in sync group schema. */ +@Fluent +public final class SyncGroupSchemaTable { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupSchemaTable.class); + + /* + * List of columns in sync group schema. + */ + @JsonProperty(value = "columns") + private List columns; + + /* + * Quoted name of sync group schema table. + */ + @JsonProperty(value = "quotedName") + private String quotedName; + + /** + * Get the columns property: List of columns in sync group schema. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Set the columns property: List of columns in sync group schema. + * + * @param columns the columns value to set. + * @return the SyncGroupSchemaTable object itself. + */ + public SyncGroupSchemaTable withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get the quotedName property: Quoted name of sync group schema table. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set the quotedName property: Quoted name of sync group schema table. + * + * @param quotedName the quotedName value to set. + * @return the SyncGroupSchemaTable object itself. + */ + public SyncGroupSchemaTable withQuotedName(String quotedName) { + this.quotedName = quotedName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.java new file mode 100644 index 0000000000000..c654c6945fcd2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.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.sql.generated.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; + +/** Properties of column in sync group table. */ +@Fluent +public final class SyncGroupSchemaTableColumn { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncGroupSchemaTableColumn.class); + + /* + * Quoted name of sync group table column. + */ + @JsonProperty(value = "quotedName") + private String quotedName; + + /* + * Data size of the column. + */ + @JsonProperty(value = "dataSize") + private String dataSize; + + /* + * Data type of the column. + */ + @JsonProperty(value = "dataType") + private String dataType; + + /** + * Get the quotedName property: Quoted name of sync group table column. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set the quotedName property: Quoted name of sync group table column. + * + * @param quotedName the quotedName value to set. + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withQuotedName(String quotedName) { + this.quotedName = quotedName; + return this; + } + + /** + * Get the dataSize property: Data size of the column. + * + * @return the dataSize value. + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Set the dataSize property: Data size of the column. + * + * @param dataSize the dataSize value to set. + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withDataSize(String dataSize) { + this.dataSize = dataSize; + return this; + } + + /** + * Get the dataType property: Data type of the column. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Set the dataType property: Data type of the column. + * + * @param dataType the dataType value to set. + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withDataType(String dataType) { + this.dataType = dataType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupState.java new file mode 100644 index 0000000000000..9e66595f25492 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncGroupState. */ +public final class SyncGroupState extends ExpandableStringEnum { + /** Static value NotReady for SyncGroupState. */ + public static final SyncGroupState NOT_READY = fromString("NotReady"); + + /** Static value Error for SyncGroupState. */ + public static final SyncGroupState ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupState. */ + public static final SyncGroupState WARNING = fromString("Warning"); + + /** Static value Progressing for SyncGroupState. */ + public static final SyncGroupState PROGRESSING = fromString("Progressing"); + + /** Static value Good for SyncGroupState. */ + public static final SyncGroupState GOOD = fromString("Good"); + + /** + * Creates or finds a SyncGroupState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncGroupState. + */ + @JsonCreator + public static SyncGroupState fromString(String name) { + return fromString(name, SyncGroupState.class); + } + + /** @return known SyncGroupState values. */ + public static Collection values() { + return values(SyncGroupState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroups.java new file mode 100644 index 0000000000000..6c6eca3b70634 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroups.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 SyncGroups. */ +public interface SyncGroups { + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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 collection of sync database ids. + */ + PagedIterable listSyncDatabaseIds(String locationName); + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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 collection of sync database ids. + */ + PagedIterable listSyncDatabaseIds(String locationName, Context context); + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas. + */ + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @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 collection of sync group logs. + */ + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type); + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. + * @param continuationToken The continuation token for this operation. + * @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 collection of sync group logs. + */ + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context); + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + SyncGroup get(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Deletes a sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Lists sync groups under a hub database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a sync group. + * + * @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 sync group. + */ + SyncGroup getById(String id); + + /** + * Gets a sync group. + * + * @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 sync group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a sync group. + * + * @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 sync group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SyncGroup resource. + * + * @param name resource name. + * @return the first stage of the new SyncGroup definition. + */ + SyncGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupsType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupsType.java new file mode 100644 index 0000000000000..3301065538120 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupsType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncGroupsType. */ +public final class SyncGroupsType extends ExpandableStringEnum { + /** Static value All for SyncGroupsType. */ + public static final SyncGroupsType ALL = fromString("All"); + + /** Static value Error for SyncGroupsType. */ + public static final SyncGroupsType ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupsType. */ + public static final SyncGroupsType WARNING = fromString("Warning"); + + /** Static value Success for SyncGroupsType. */ + public static final SyncGroupsType SUCCESS = fromString("Success"); + + /** + * Creates or finds a SyncGroupsType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncGroupsType. + */ + @JsonCreator + public static SyncGroupsType fromString(String name) { + return fromString(name, SyncGroupsType.class); + } + + /** @return known SyncGroupsType values. */ + public static Collection values() { + return values(SyncGroupsType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java new file mode 100644 index 0000000000000..70594cfdb09b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import java.util.UUID; + +/** An immutable client-side representation of SyncMember. */ +public interface SyncMember { + /** + * 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 databaseType property: Database type of the sync member. + * + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * Gets the syncAgentId property: ARM resource id of the sync agent in the sync member. + * + * @return the syncAgentId value. + */ + String syncAgentId(); + + /** + * Gets the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value. + */ + UUID sqlServerDatabaseId(); + + /** + * Gets the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for + * sync members in Azure. + * + * @return the syncMemberAzureDatabaseResourceId value. + */ + String syncMemberAzureDatabaseResourceId(); + + /** + * Gets the usePrivateLinkConnection property: Whether to use private link connection. + * + * @return the usePrivateLinkConnection value. + */ + Boolean usePrivateLinkConnection(); + + /** + * Gets the privateEndpointName property: Private endpoint name of the sync member if use private link connection is + * enabled, for sync members in Azure. + * + * @return the privateEndpointName value. + */ + String privateEndpointName(); + + /** + * Gets the serverName property: Server name of the member database in the sync member. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the databaseName property: Database name of the member database in the sync member. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the username property: User name of the member database in the sync member. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: Password of the member database in the sync member. + * + * @return the password value. + */ + String password(); + + /** + * Gets the syncDirection property: Sync direction of the sync member. + * + * @return the syncDirection value. + */ + SyncDirection syncDirection(); + + /** + * Gets the syncState property: Sync state of the sync member. + * + * @return the syncState value. + */ + SyncMemberState syncState(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner object. + * + * @return the inner object. + */ + SyncMemberInner innerModel(); + + /** The entirety of the SyncMember definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SyncMember definition stages. */ + interface DefinitionStages { + /** The first stage of the SyncMember definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SyncMember definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, syncGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @return the next definition stage. + */ + WithCreate withExistingSyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + } + /** + * The stage of the SyncMember 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.WithDatabaseType, + DefinitionStages.WithSyncAgentId, + DefinitionStages.WithSqlServerDatabaseId, + DefinitionStages.WithSyncMemberAzureDatabaseResourceId, + DefinitionStages.WithUsePrivateLinkConnection, + DefinitionStages.WithServerName, + DefinitionStages.WithDatabaseName, + DefinitionStages.WithUsername, + DefinitionStages.WithPassword, + DefinitionStages.WithSyncDirection { + /** + * Executes the create request. + * + * @return the created resource. + */ + SyncMember create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SyncMember create(Context context); + } + /** The stage of the SyncMember definition allowing to specify databaseType. */ + interface WithDatabaseType { + /** + * Specifies the databaseType property: Database type of the sync member.. + * + * @param databaseType Database type of the sync member. + * @return the next definition stage. + */ + WithCreate withDatabaseType(SyncMemberDbType databaseType); + } + /** The stage of the SyncMember definition allowing to specify syncAgentId. */ + interface WithSyncAgentId { + /** + * Specifies the syncAgentId property: ARM resource id of the sync agent in the sync member.. + * + * @param syncAgentId ARM resource id of the sync agent in the sync member. + * @return the next definition stage. + */ + WithCreate withSyncAgentId(String syncAgentId); + } + /** The stage of the SyncMember definition allowing to specify sqlServerDatabaseId. */ + interface WithSqlServerDatabaseId { + /** + * Specifies the sqlServerDatabaseId property: SQL Server database id of the sync member.. + * + * @param sqlServerDatabaseId SQL Server database id of the sync member. + * @return the next definition stage. + */ + WithCreate withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + /** The stage of the SyncMember definition allowing to specify syncMemberAzureDatabaseResourceId. */ + interface WithSyncMemberAzureDatabaseResourceId { + /** + * Specifies the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical + * database, for sync members in Azure.. + * + * @param syncMemberAzureDatabaseResourceId ARM resource id of the sync member logical database, for sync + * members in Azure. + * @return the next definition stage. + */ + WithCreate withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId); + } + /** The stage of the SyncMember definition allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: Whether to use private link connection.. + * + * @param usePrivateLinkConnection Whether to use private link connection. + * @return the next definition stage. + */ + WithCreate withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + /** The stage of the SyncMember definition allowing to specify serverName. */ + interface WithServerName { + /** + * Specifies the serverName property: Server name of the member database in the sync member. + * + * @param serverName Server name of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withServerName(String serverName); + } + /** The stage of the SyncMember definition allowing to specify databaseName. */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: Database name of the member database in the sync member.. + * + * @param databaseName Database name of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withDatabaseName(String databaseName); + } + /** The stage of the SyncMember definition allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: User name of the member database in the sync member.. + * + * @param username User name of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withUsername(String username); + } + /** The stage of the SyncMember definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Password of the member database in the sync member.. + * + * @param password Password of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + /** The stage of the SyncMember definition allowing to specify syncDirection. */ + interface WithSyncDirection { + /** + * Specifies the syncDirection property: Sync direction of the sync member.. + * + * @param syncDirection Sync direction of the sync member. + * @return the next definition stage. + */ + WithCreate withSyncDirection(SyncDirection syncDirection); + } + } + /** + * Begins update for the SyncMember resource. + * + * @return the stage of resource update. + */ + SyncMember.Update update(); + + /** The template for SyncMember update. */ + interface Update + extends UpdateStages.WithDatabaseType, + UpdateStages.WithSyncAgentId, + UpdateStages.WithSqlServerDatabaseId, + UpdateStages.WithSyncMemberAzureDatabaseResourceId, + UpdateStages.WithUsePrivateLinkConnection, + UpdateStages.WithServerName, + UpdateStages.WithDatabaseName, + UpdateStages.WithUsername, + UpdateStages.WithPassword, + UpdateStages.WithSyncDirection { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SyncMember apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SyncMember apply(Context context); + } + /** The SyncMember update stages. */ + interface UpdateStages { + /** The stage of the SyncMember update allowing to specify databaseType. */ + interface WithDatabaseType { + /** + * Specifies the databaseType property: Database type of the sync member.. + * + * @param databaseType Database type of the sync member. + * @return the next definition stage. + */ + Update withDatabaseType(SyncMemberDbType databaseType); + } + /** The stage of the SyncMember update allowing to specify syncAgentId. */ + interface WithSyncAgentId { + /** + * Specifies the syncAgentId property: ARM resource id of the sync agent in the sync member.. + * + * @param syncAgentId ARM resource id of the sync agent in the sync member. + * @return the next definition stage. + */ + Update withSyncAgentId(String syncAgentId); + } + /** The stage of the SyncMember update allowing to specify sqlServerDatabaseId. */ + interface WithSqlServerDatabaseId { + /** + * Specifies the sqlServerDatabaseId property: SQL Server database id of the sync member.. + * + * @param sqlServerDatabaseId SQL Server database id of the sync member. + * @return the next definition stage. + */ + Update withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + /** The stage of the SyncMember update allowing to specify syncMemberAzureDatabaseResourceId. */ + interface WithSyncMemberAzureDatabaseResourceId { + /** + * Specifies the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical + * database, for sync members in Azure.. + * + * @param syncMemberAzureDatabaseResourceId ARM resource id of the sync member logical database, for sync + * members in Azure. + * @return the next definition stage. + */ + Update withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId); + } + /** The stage of the SyncMember update allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: Whether to use private link connection.. + * + * @param usePrivateLinkConnection Whether to use private link connection. + * @return the next definition stage. + */ + Update withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + /** The stage of the SyncMember update allowing to specify serverName. */ + interface WithServerName { + /** + * Specifies the serverName property: Server name of the member database in the sync member. + * + * @param serverName Server name of the member database in the sync member. + * @return the next definition stage. + */ + Update withServerName(String serverName); + } + /** The stage of the SyncMember update allowing to specify databaseName. */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: Database name of the member database in the sync member.. + * + * @param databaseName Database name of the member database in the sync member. + * @return the next definition stage. + */ + Update withDatabaseName(String databaseName); + } + /** The stage of the SyncMember update allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: User name of the member database in the sync member.. + * + * @param username User name of the member database in the sync member. + * @return the next definition stage. + */ + Update withUsername(String username); + } + /** The stage of the SyncMember update allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Password of the member database in the sync member.. + * + * @param password Password of the member database in the sync member. + * @return the next definition stage. + */ + Update withPassword(String password); + } + /** The stage of the SyncMember update allowing to specify syncDirection. */ + interface WithSyncDirection { + /** + * Specifies the syncDirection property: Sync direction of the sync member.. + * + * @param syncDirection Sync direction of the sync member. + * @return the next definition stage. + */ + Update withSyncDirection(SyncDirection syncDirection); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SyncMember refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SyncMember refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberDbType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberDbType.java new file mode 100644 index 0000000000000..143b853b345df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberDbType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncMemberDbType. */ +public final class SyncMemberDbType extends ExpandableStringEnum { + /** Static value AzureSqlDatabase for SyncMemberDbType. */ + public static final SyncMemberDbType AZURE_SQL_DATABASE = fromString("AzureSqlDatabase"); + + /** Static value SqlServerDatabase for SyncMemberDbType. */ + public static final SyncMemberDbType SQL_SERVER_DATABASE = fromString("SqlServerDatabase"); + + /** + * Creates or finds a SyncMemberDbType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncMemberDbType. + */ + @JsonCreator + public static SyncMemberDbType fromString(String name) { + return fromString(name, SyncMemberDbType.class); + } + + /** @return known SyncMemberDbType values. */ + public static Collection values() { + return values(SyncMemberDbType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.java new file mode 100644 index 0000000000000..c1e6f5d7147fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL Database sync members. */ +@Immutable +public final class SyncMemberListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyncMemberListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberState.java new file mode 100644 index 0000000000000..d3e0fcfe7d321 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberState.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncMemberState. */ +public final class SyncMemberState extends ExpandableStringEnum { + /** Static value SyncInProgress for SyncMemberState. */ + public static final SyncMemberState SYNC_IN_PROGRESS = fromString("SyncInProgress"); + + /** Static value SyncSucceeded for SyncMemberState. */ + public static final SyncMemberState SYNC_SUCCEEDED = fromString("SyncSucceeded"); + + /** Static value SyncFailed for SyncMemberState. */ + public static final SyncMemberState SYNC_FAILED = fromString("SyncFailed"); + + /** Static value DisabledTombstoneCleanup for SyncMemberState. */ + public static final SyncMemberState DISABLED_TOMBSTONE_CLEANUP = fromString("DisabledTombstoneCleanup"); + + /** Static value DisabledBackupRestore for SyncMemberState. */ + public static final SyncMemberState DISABLED_BACKUP_RESTORE = fromString("DisabledBackupRestore"); + + /** Static value SyncSucceededWithWarnings for SyncMemberState. */ + public static final SyncMemberState SYNC_SUCCEEDED_WITH_WARNINGS = fromString("SyncSucceededWithWarnings"); + + /** Static value SyncCancelling for SyncMemberState. */ + public static final SyncMemberState SYNC_CANCELLING = fromString("SyncCancelling"); + + /** Static value SyncCancelled for SyncMemberState. */ + public static final SyncMemberState SYNC_CANCELLED = fromString("SyncCancelled"); + + /** Static value UnProvisioned for SyncMemberState. */ + public static final SyncMemberState UN_PROVISIONED = fromString("UnProvisioned"); + + /** Static value Provisioning for SyncMemberState. */ + public static final SyncMemberState PROVISIONING = fromString("Provisioning"); + + /** Static value Provisioned for SyncMemberState. */ + public static final SyncMemberState PROVISIONED = fromString("Provisioned"); + + /** Static value ProvisionFailed for SyncMemberState. */ + public static final SyncMemberState PROVISION_FAILED = fromString("ProvisionFailed"); + + /** Static value DeProvisioning for SyncMemberState. */ + public static final SyncMemberState DE_PROVISIONING = fromString("DeProvisioning"); + + /** Static value DeProvisioned for SyncMemberState. */ + public static final SyncMemberState DE_PROVISIONED = fromString("DeProvisioned"); + + /** Static value DeProvisionFailed for SyncMemberState. */ + public static final SyncMemberState DE_PROVISION_FAILED = fromString("DeProvisionFailed"); + + /** Static value Reprovisioning for SyncMemberState. */ + public static final SyncMemberState REPROVISIONING = fromString("Reprovisioning"); + + /** Static value ReprovisionFailed for SyncMemberState. */ + public static final SyncMemberState REPROVISION_FAILED = fromString("ReprovisionFailed"); + + /** Static value UnReprovisioned for SyncMemberState. */ + public static final SyncMemberState UN_REPROVISIONED = fromString("UnReprovisioned"); + + /** + * Creates or finds a SyncMemberState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncMemberState. + */ + @JsonCreator + public static SyncMemberState fromString(String name) { + return fromString(name, SyncMemberState.class); + } + + /** @return known SyncMemberState values. */ + public static Collection values() { + return values(SyncMemberState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMembers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMembers.java new file mode 100644 index 0000000000000..77b9c09ee163e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMembers.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 SyncMembers. */ +public interface SyncMembers { + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member. + */ + SyncMember get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Lists sync members in the given sync group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members. + */ + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member database schema. + */ + PagedIterable listMemberSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 sync member database schema. + */ + PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Gets a sync member. + * + * @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 sync member. + */ + SyncMember getById(String id); + + /** + * Gets a sync member. + * + * @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 sync member. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a sync member. + * + * @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 sync member. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SyncMember resource. + * + * @param name resource name. + * @return the first stage of the new SyncMember definition. + */ + SyncMember.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TargetBackupStorageRedundancy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TargetBackupStorageRedundancy.java new file mode 100644 index 0000000000000..9f0f894b4c4ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TargetBackupStorageRedundancy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TargetBackupStorageRedundancy. */ +public final class TargetBackupStorageRedundancy extends ExpandableStringEnum { + /** Static value Geo for TargetBackupStorageRedundancy. */ + public static final TargetBackupStorageRedundancy GEO = fromString("Geo"); + + /** Static value Local for TargetBackupStorageRedundancy. */ + public static final TargetBackupStorageRedundancy LOCAL = fromString("Local"); + + /** Static value Zone for TargetBackupStorageRedundancy. */ + public static final TargetBackupStorageRedundancy ZONE = fromString("Zone"); + + /** + * Creates or finds a TargetBackupStorageRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding TargetBackupStorageRedundancy. + */ + @JsonCreator + public static TargetBackupStorageRedundancy fromString(String name) { + return fromString(name, TargetBackupStorageRedundancy.class); + } + + /** @return known TargetBackupStorageRedundancy values. */ + public static Collection values() { + return values(TargetBackupStorageRedundancy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.java new file mode 100644 index 0000000000000..a2d28f0a762b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A TDE certificate that can be uploaded into a server. */ +@JsonFlatten +@Fluent +public class TdeCertificate extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TdeCertificate.class); + + /* + * The base64 encoded certificate private blob. + */ + @JsonProperty(value = "properties.privateBlob") + private String privateBlob; + + /* + * The certificate password. + */ + @JsonProperty(value = "properties.certPassword") + private String certPassword; + + /** + * Get the privateBlob property: The base64 encoded certificate private blob. + * + * @return the privateBlob value. + */ + public String privateBlob() { + return this.privateBlob; + } + + /** + * Set the privateBlob property: The base64 encoded certificate private blob. + * + * @param privateBlob the privateBlob value to set. + * @return the TdeCertificate object itself. + */ + public TdeCertificate withPrivateBlob(String privateBlob) { + this.privateBlob = privateBlob; + return this; + } + + /** + * Get the certPassword property: The certificate password. + * + * @return the certPassword value. + */ + public String certPassword() { + return this.certPassword; + } + + /** + * Set the certPassword property: The certificate password. + * + * @param certPassword the certPassword value to set. + * @return the TdeCertificate object itself. + */ + public TdeCertificate withCertPassword(String certPassword) { + this.certPassword = certPassword; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificates.java new file mode 100644 index 0000000000000..9f902f7cc49eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificates.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of TdeCertificates. */ +public interface TdeCertificates { + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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. + */ + void create(String resourceGroupName, String serverName, TdeCertificate parameters); + + /** + * Creates a TDE certificate for a given server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param parameters The requested TDE certificate 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. + */ + void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.java new file mode 100644 index 0000000000000..5774787cdff35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import java.util.List; + +/** An immutable client-side representation of TopQueries. */ +public interface TopQueries { + /** + * Gets the numberOfQueries property: Requested number of top queries. + * + * @return the numberOfQueries value. + */ + Integer numberOfQueries(); + + /** + * Gets the aggregationFunction property: Aggregation function used to calculate query metrics. + * + * @return the aggregationFunction value. + */ + String aggregationFunction(); + + /** + * Gets the observationMetric property: Metric used to rank queries. + * + * @return the observationMetric value. + */ + String observationMetric(); + + /** + * Gets the intervalType property: Interval type (length). + * + * @return the intervalType value. + */ + QueryTimeGrainType intervalType(); + + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + String startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + String endTime(); + + /** + * Gets the queries property: List of top resource consuming queries with appropriate metric data. + * + * @return the queries value. + */ + List queries(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner object. + * + * @return the inner object. + */ + TopQueriesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.java new file mode 100644 index 0000000000000..a474a3024f0ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of top resource consuming queries on managed instance. */ +@Immutable +public final class TopQueriesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopQueriesListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TrackedResource.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TrackedResource.java new file mode 100644 index 0000000000000..52e706fab7537 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TrackedResource.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; +import java.util.Map; + +/** ARM tracked top level resource. */ +@Fluent +public final class TrackedResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TrackedResource.class); + + /* + * Resource location. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Resource location. + * + * @param location the location value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TrackedResource object itself. + */ + public TrackedResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model TrackedResource")); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryption.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryption.java new file mode 100644 index 0000000000000..c6624dab7191f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryption.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionInner; + +/** An immutable client-side representation of TransparentDataEncryption. */ +public interface TransparentDataEncryption { + /** + * 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: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the status property: The status of the database transparent data encryption. + * + * @return the status value. + */ + TransparentDataEncryptionStatus status(); + + /** + * 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.sql.generated.fluent.models.TransparentDataEncryptionInner object. + * + * @return the inner object. + */ + TransparentDataEncryptionInner innerModel(); + + /** The entirety of the TransparentDataEncryption definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The TransparentDataEncryption definition stages. */ + interface DefinitionStages { + /** The first stage of the TransparentDataEncryption definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the TransparentDataEncryption definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which setting the transparent data encryption applies. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the TransparentDataEncryption 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.WithStatus { + /** + * Executes the create request. + * + * @return the created resource. + */ + TransparentDataEncryption create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TransparentDataEncryption create(Context context); + } + /** The stage of the TransparentDataEncryption definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: The status of the database transparent data encryption.. + * + * @param status The status of the database transparent data encryption. + * @return the next definition stage. + */ + WithCreate withStatus(TransparentDataEncryptionStatus status); + } + } + /** + * Begins update for the TransparentDataEncryption resource. + * + * @return the stage of resource update. + */ + TransparentDataEncryption.Update update(); + + /** The template for TransparentDataEncryption update. */ + interface Update extends UpdateStages.WithStatus { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TransparentDataEncryption apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TransparentDataEncryption apply(Context context); + } + /** The TransparentDataEncryption update stages. */ + interface UpdateStages { + /** The stage of the TransparentDataEncryption update allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: The status of the database transparent data encryption.. + * + * @param status The status of the database transparent data encryption. + * @return the next definition stage. + */ + Update withStatus(TransparentDataEncryptionStatus status); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TransparentDataEncryption refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TransparentDataEncryption refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivities.java new file mode 100644 index 0000000000000..d61395ed5b5fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivities.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TransparentDataEncryptionActivities. */ +public interface TransparentDataEncryptionActivities { + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 represents the response to a list database transparent data encryption activity request. + */ + PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName); + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 represents the response to a list database transparent data encryption activity request. + */ + PagedIterable listByConfiguration( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivity.java new file mode 100644 index 0000000000000..d7b8c7854c7d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivity.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.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionActivityInner; + +/** An immutable client-side representation of TransparentDataEncryptionActivity. */ +public interface TransparentDataEncryptionActivity { + /** + * 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: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the status property: The status of the database. + * + * @return the status value. + */ + TransparentDataEncryptionActivityStatus status(); + + /** + * Gets the percentComplete property: The percent complete of the transparent data encryption scan for a database. + * + * @return the percentComplete value. + */ + Float percentComplete(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionActivityInner + * object. + * + * @return the inner object. + */ + TransparentDataEncryptionActivityInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivityListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivityListResult.java new file mode 100644 index 0000000000000..5d374a8691f82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivityListResult.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.TransparentDataEncryptionActivityInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list database transparent data encryption activity request. */ +@Fluent +public final class TransparentDataEncryptionActivityListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransparentDataEncryptionActivityListResult.class); + + /* + * The list of database transparent data encryption activities. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the value property: The list of database transparent data encryption activities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of database transparent data encryption activities. + * + * @param value the value value to set. + * @return the TransparentDataEncryptionActivityListResult object itself. + */ + public TransparentDataEncryptionActivityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model TransparentDataEncryptionActivityListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivityStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivityStatus.java new file mode 100644 index 0000000000000..307c724a48bfa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionActivityStatus.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TransparentDataEncryptionActivityStatus. */ +public final class TransparentDataEncryptionActivityStatus + extends ExpandableStringEnum { + /** Static value Encrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus ENCRYPTING = fromString("Encrypting"); + + /** Static value Decrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus DECRYPTING = fromString("Decrypting"); + + /** + * Creates or finds a TransparentDataEncryptionActivityStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TransparentDataEncryptionActivityStatus. + */ + @JsonCreator + public static TransparentDataEncryptionActivityStatus fromString(String name) { + return fromString(name, TransparentDataEncryptionActivityStatus.class); + } + + /** @return known TransparentDataEncryptionActivityStatus values. */ + public static Collection values() { + return values(TransparentDataEncryptionActivityStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionName.java new file mode 100644 index 0000000000000..13ea16b6a3cce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TransparentDataEncryptionName. */ +public final class TransparentDataEncryptionName extends ExpandableStringEnum { + /** Static value current for TransparentDataEncryptionName. */ + public static final TransparentDataEncryptionName CURRENT = fromString("current"); + + /** + * Creates or finds a TransparentDataEncryptionName from its string representation. + * + * @param name a name to look for. + * @return the corresponding TransparentDataEncryptionName. + */ + @JsonCreator + public static TransparentDataEncryptionName fromString(String name) { + return fromString(name, TransparentDataEncryptionName.class); + } + + /** @return known TransparentDataEncryptionName values. */ + public static Collection values() { + return values(TransparentDataEncryptionName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionStatus.java new file mode 100644 index 0000000000000..c6f68d3af8ece --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for TransparentDataEncryptionStatus. */ +public enum TransparentDataEncryptionStatus { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a TransparentDataEncryptionStatus instance. */ + private final String value; + + TransparentDataEncryptionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TransparentDataEncryptionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed TransparentDataEncryptionStatus object, or null if unable to parse. + */ + @JsonCreator + public static TransparentDataEncryptionStatus fromString(String value) { + TransparentDataEncryptionStatus[] items = TransparentDataEncryptionStatus.values(); + for (TransparentDataEncryptionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.java new file mode 100644 index 0000000000000..7e020342e6db6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TransparentDataEncryptions. */ +public interface TransparentDataEncryptions { + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 database's transparent data encryption configuration. + */ + TransparentDataEncryption get( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName); + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the transparent data encryption applies. + * @param transparentDataEncryptionName The name of the transparent data encryption configuration. + * @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 database's transparent data encryption configuration. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName transparentDataEncryptionName, + Context context); + + /** + * Gets a database's transparent data encryption configuration. + * + * @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 database's transparent data encryption configuration. + */ + TransparentDataEncryption getById(String id); + + /** + * Gets a database's transparent data encryption configuration. + * + * @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 database's transparent data encryption configuration. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TransparentDataEncryption resource. + * + * @param name resource name. + * @return the first stage of the new TransparentDataEncryption definition. + */ + TransparentDataEncryption.DefinitionStages.Blank define(TransparentDataEncryptionName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitDefinitionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitDefinitionType.java new file mode 100644 index 0000000000000..b2b9c18a3a85a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitDefinitionType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UnitDefinitionType. */ +public final class UnitDefinitionType extends ExpandableStringEnum { + /** Static value Count for UnitDefinitionType. */ + public static final UnitDefinitionType COUNT = fromString("Count"); + + /** Static value Bytes for UnitDefinitionType. */ + public static final UnitDefinitionType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitDefinitionType. */ + public static final UnitDefinitionType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitDefinitionType. */ + public static final UnitDefinitionType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitDefinitionType. */ + public static final UnitDefinitionType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitDefinitionType. */ + public static final UnitDefinitionType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** + * Creates or finds a UnitDefinitionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnitDefinitionType. + */ + @JsonCreator + public static UnitDefinitionType fromString(String name) { + return fromString(name, UnitDefinitionType.class); + } + + /** @return known UnitDefinitionType values. */ + public static Collection values() { + return values(UnitDefinitionType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitType.java new file mode 100644 index 0000000000000..165a1fd281466 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitType.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UnitType. */ +public final class UnitType extends ExpandableStringEnum { + /** Static value count for UnitType. */ + public static final UnitType COUNT = fromString("count"); + + /** Static value bytes for UnitType. */ + public static final UnitType BYTES = fromString("bytes"); + + /** Static value seconds for UnitType. */ + public static final UnitType SECONDS = fromString("seconds"); + + /** Static value percent for UnitType. */ + public static final UnitType PERCENT = fromString("percent"); + + /** Static value countPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("countPerSecond"); + + /** Static value bytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("bytesPerSecond"); + + /** + * Creates or finds a UnitType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnitType. + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** @return known UnitType values. */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnlinkParameters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnlinkParameters.java new file mode 100644 index 0000000000000..195de6101b4eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnlinkParameters.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Represents the parameters for Unlink Replication Link request. */ +@Fluent +public final class UnlinkParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UnlinkParameters.class); + + /* + * Determines whether link will be terminated in a forced or a friendly + * way. + */ + @JsonProperty(value = "forcedTermination") + private Boolean forcedTermination; + + /** + * Get the forcedTermination property: Determines whether link will be terminated in a forced or a friendly way. + * + * @return the forcedTermination value. + */ + public Boolean forcedTermination() { + return this.forcedTermination; + } + + /** + * Set the forcedTermination property: Determines whether link will be terminated in a forced or a friendly way. + * + * @param forcedTermination the forcedTermination value to set. + * @return the UnlinkParameters object itself. + */ + public UnlinkParameters withForcedTermination(Boolean forcedTermination) { + this.forcedTermination = forcedTermination; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.java new file mode 100644 index 0000000000000..3e8031202e297 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.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.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform long term retention backup update operation. */ +@JsonFlatten +@Fluent +public class UpdateLongTermRetentionBackupParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateLongTermRetentionBackupParameters.class); + + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "properties.requestedBackupStorageRedundancy") + private RequestedBackupStorageRedundancy requestedBackupStorageRedundancy; + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public RequestedBackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the UpdateLongTermRetentionBackupParameters object itself. + */ + public UpdateLongTermRetentionBackupParameters withRequestedBackupStorageRedundancy( + RequestedBackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java new file mode 100644 index 0000000000000..11361c2f95638 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 UpsertManagedServerOperationParameters model. */ +@Fluent +public final class UpsertManagedServerOperationParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpsertManagedServerOperationParameters.class); + + /* + * The family property. + */ + @JsonProperty(value = "family") + private String family; + + /* + * The tier property. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * The vCores property. + */ + @JsonProperty(value = "vCores") + private Integer vCores; + + /* + * The storageSizeInGB property. + */ + @JsonProperty(value = "storageSizeInGB") + private Integer storageSizeInGB; + + /** + * Get the family property: The family property. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The family property. + * + * @param family the family value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the tier property: The tier property. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The tier property. + * + * @param tier the tier value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the vCores property: The vCores property. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores property: The vCores property. + * + * @param vCores the vCores value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB property: The storageSizeInGB property. + * + * @return the storageSizeInGB value. + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB property: The storageSizeInGB property. + * + * @param storageSizeInGB the storageSizeInGB value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.java new file mode 100644 index 0000000000000..f4d295856ff5a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.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.sql.generated.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 UpsertManagedServerOperationStep model. */ +@Fluent +public final class UpsertManagedServerOperationStep { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpsertManagedServerOperationStep.class); + + /* + * The order property. + */ + @JsonProperty(value = "order") + private Integer order; + + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The status property. + */ + @JsonProperty(value = "status") + private UpsertManagedServerOperationStepStatus status; + + /** + * Get the order property: The order property. + * + * @return the order value. + */ + public Integer order() { + return this.order; + } + + /** + * Set the order property: The order property. + * + * @param order the order value to set. + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withOrder(Integer order) { + this.order = order; + return this; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + public UpsertManagedServerOperationStepStatus status() { + return this.status; + } + + /** + * Set the status property: The status property. + * + * @param status the status value to set. + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withStatus(UpsertManagedServerOperationStepStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStepStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStepStatus.java new file mode 100644 index 0000000000000..01fdba00277c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStepStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UpsertManagedServerOperationStepStatus. */ +public final class UpsertManagedServerOperationStepStatus + extends ExpandableStringEnum { + /** Static value NotStarted for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus NOT_STARTED = fromString("NotStarted"); + + /** Static value InProgress for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value SlowedDown for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus SLOWED_DOWN = fromString("SlowedDown"); + + /** Static value Completed for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus COMPLETED = fromString("Completed"); + + /** Static value Failed for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus FAILED = fromString("Failed"); + + /** Static value Canceled for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus CANCELED = fromString("Canceled"); + + /** + * Creates or finds a UpsertManagedServerOperationStepStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding UpsertManagedServerOperationStepStatus. + */ + @JsonCreator + public static UpsertManagedServerOperationStepStatus fromString(String name) { + return fromString(name, UpsertManagedServerOperationStepStatus.class); + } + + /** @return known UpsertManagedServerOperationStepStatus values. */ + public static Collection values() { + return values(UpsertManagedServerOperationStepStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usage.java new file mode 100644 index 0000000000000..430b5f558d3ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the id property: Resource ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + Name name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the unit property: Usage unit. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the currentValue property: Usage current value. + * + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * Gets the limit property: Usage limit. + * + * @return the limit value. + */ + Integer limit(); + + /** + * Gets the requestedLimit property: Usage requested limit. + * + * @return the requestedLimit value. + */ + Integer requestedLimit(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.java new file mode 100644 index 0000000000000..acbe2724d78a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of usages. */ +@Immutable +public final class UsageListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usages.java new file mode 100644 index 0000000000000..8e268cb707b54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usages.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Usages. */ +public interface Usages { + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @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 instance pool usage metrics. + */ + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics. + */ + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.java new file mode 100644 index 0000000000000..548db9a9d8a46 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualCluster. */ +public interface VirtualCluster { + /** + * 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 subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + String subnetId(); + + /** + * Gets 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. + */ + String family(); + + /** + * Gets the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + List childResources(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner object. + * + * @return the inner object. + */ + VirtualClusterInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.java new file mode 100644 index 0000000000000..74b8c45fc14cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual clusters. */ +@Immutable +public final class VirtualClusterListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualClusterListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.java new file mode 100644 index 0000000000000..e0695b6fd1b47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An update request for an Azure SQL Database virtual cluster. */ +@JsonFlatten +@Fluent +public class VirtualClusterUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualClusterUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "properties.subnetId", access = JsonProperty.Access.WRITE_ONLY) + private String subnetId; + + /* + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "properties.family") + private String family; + + /* + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "properties.childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /** + * 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 VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * 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 VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + public List childResources() { + return this.childResources; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.java new file mode 100644 index 0000000000000..bdad3ceb70bf6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 VirtualClusters. */ +public interface VirtualClusters { + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + PagedIterable list(); + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The 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 a list of virtual clusters in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtual cluster. + */ + VirtualCluster getByResourceGroup(String resourceGroupName, String virtualClusterName); + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtual cluster. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName); + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualClusterName, Context context); + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + VirtualCluster update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters); + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @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 an Azure SQL virtual cluster. + */ + VirtualCluster update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRule.java new file mode 100644 index 0000000000000..bc7fbf54e91b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRule.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; + +/** An immutable client-side representation of VirtualNetworkRule. */ +public interface VirtualNetworkRule { + /** + * 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 virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * Gets the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + Boolean ignoreMissingVnetServiceEndpoint(); + + /** + * Gets the state property: Virtual Network Rule State. + * + * @return the state value. + */ + VirtualNetworkRuleState state(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner object. + * + * @return the inner object. + */ + VirtualNetworkRuleInner innerModel(); + + /** The entirety of the VirtualNetworkRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The VirtualNetworkRule definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualNetworkRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the VirtualNetworkRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the VirtualNetworkRule 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.WithVirtualNetworkSubnetId, DefinitionStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualNetworkRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualNetworkRule create(Context context); + } + /** The stage of the VirtualNetworkRule definition allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + WithCreate withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule definition allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Begins update for the VirtualNetworkRule resource. + * + * @return the stage of resource update. + */ + VirtualNetworkRule.Update update(); + + /** The template for VirtualNetworkRule update. */ + interface Update + extends UpdateStages.WithVirtualNetworkSubnetId, UpdateStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualNetworkRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualNetworkRule apply(Context context); + } + /** The VirtualNetworkRule update stages. */ + interface UpdateStages { + /** The stage of the VirtualNetworkRule update allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + Update withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule update allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.java new file mode 100644 index 0000000000000..e1cc188045ebd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual network rules. */ +@Immutable +public final class VirtualNetworkRuleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.java new file mode 100644 index 0000000000000..3d66e1bd7016f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualNetworkRuleState. */ +public final class VirtualNetworkRuleState extends ExpandableStringEnum { + /** Static value Initializing for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); + + /** Static value InProgress for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); + + /** Static value Ready for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState READY = fromString("Ready"); + + /** Static value Deleting for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); + + /** Static value Unknown for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a VirtualNetworkRuleState from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualNetworkRuleState. + */ + @JsonCreator + public static VirtualNetworkRuleState fromString(String name) { + return fromString(name, VirtualNetworkRuleState.class); + } + + /** @return known VirtualNetworkRuleState values. */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRules.java new file mode 100644 index 0000000000000..d6519ac025d82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRules.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 VirtualNetworkRules. */ +public interface VirtualNetworkRules { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 virtual network rule. + */ + VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 virtual network rule. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @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 serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 list of virtual network rules in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the 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 a list of virtual network rules in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a virtual network rule. + * + * @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 virtual network rule. + */ + VirtualNetworkRule getById(String id); + + /** + * Gets a virtual network rule. + * + * @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 virtual network rule. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the virtual network rule with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new VirtualNetworkRule resource. + * + * @param name resource name. + * @return the first stage of the new VirtualNetworkRule definition. + */ + VirtualNetworkRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentName.java new file mode 100644 index 0000000000000..9586e07133572 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentName.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.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VulnerabilityAssessmentName. */ +public final class VulnerabilityAssessmentName extends ExpandableStringEnum { + /** Static value default for VulnerabilityAssessmentName. */ + public static final VulnerabilityAssessmentName DEFAULT = fromString("default"); + + /** + * Creates or finds a VulnerabilityAssessmentName from its string representation. + * + * @param name a name to look for. + * @return the corresponding VulnerabilityAssessmentName. + */ + @JsonCreator + public static VulnerabilityAssessmentName fromString(String name) { + return fromString(name, VulnerabilityAssessmentName.class); + } + + /** @return known VulnerabilityAssessmentName values. */ + public static Collection values() { + return values(VulnerabilityAssessmentName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentPolicyBaselineName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentPolicyBaselineName.java new file mode 100644 index 0000000000000..47c7983536041 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentPolicyBaselineName.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for VulnerabilityAssessmentPolicyBaselineName. */ +public enum VulnerabilityAssessmentPolicyBaselineName { + /** Enum value master. */ + MASTER("master"), + + /** Enum value default. */ + DEFAULT("default"); + + /** The actual serialized value for a VulnerabilityAssessmentPolicyBaselineName instance. */ + private final String value; + + VulnerabilityAssessmentPolicyBaselineName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a VulnerabilityAssessmentPolicyBaselineName instance. + * + * @param value the serialized value to parse. + * @return the parsed VulnerabilityAssessmentPolicyBaselineName object, or null if unable to parse. + */ + @JsonCreator + public static VulnerabilityAssessmentPolicyBaselineName fromString(String value) { + VulnerabilityAssessmentPolicyBaselineName[] items = VulnerabilityAssessmentPolicyBaselineName.values(); + for (VulnerabilityAssessmentPolicyBaselineName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..b459ad73bba30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties of a Vulnerability Assessment recurring scans. */ +@Fluent +public final class VulnerabilityAssessmentRecurringScansProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VulnerabilityAssessmentRecurringScansProperties.class); + + /* + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /* + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /* + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get the isEnabled property: Recurring scans state. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Recurring scans state. + * + * @param isEnabled the isEnabled value to set. + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the emailSubscriptionAdmins property: Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + * + * @return the emailSubscriptionAdmins value. + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set the emailSubscriptionAdmins property: Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set. + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins( + Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get the emails property: Specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value. + */ + public List emails() { + return this.emails; + } + + /** + * Set the emails property: Specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set. + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.java new file mode 100644 index 0000000000000..71c8c45c02413 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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; + +/** Properties of a vulnerability assessment scan error. */ +@Immutable +public final class VulnerabilityAssessmentScanError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VulnerabilityAssessmentScanError.class); + + /* + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecord.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..3462920d35a60 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecord.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of VulnerabilityAssessmentScanRecord. */ +public interface VulnerabilityAssessmentScanRecord { + /** + * 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 scanId property: The scan ID. + * + * @return the scanId value. + */ + String scanId(); + + /** + * Gets the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * Gets the state property: The scan status. + * + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * Gets the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the errors property: The scan errors. + * + * @return the errors value. + */ + List errors(); + + /** + * Gets the storageContainerPath property: The scan results storage container path. + * + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * Gets the numberOfFailedSecurityChecks property: The number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner + * object. + * + * @return the inner object. + */ + VulnerabilityAssessmentScanRecordInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.java new file mode 100644 index 0000000000000..2f1b0c836ace9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of vulnerability assessment scan records. */ +@Immutable +public final class VulnerabilityAssessmentScanRecordListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VulnerabilityAssessmentScanRecordListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanState.java new file mode 100644 index 0000000000000..c1593ca591ed3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VulnerabilityAssessmentScanState. */ +public final class VulnerabilityAssessmentScanState extends ExpandableStringEnum { + /** Static value Passed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState PASSED = fromString("Passed"); + + /** Static value Failed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED = fromString("Failed"); + + /** Static value FailedToRun for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED_TO_RUN = fromString("FailedToRun"); + + /** Static value InProgress for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState IN_PROGRESS = fromString("InProgress"); + + /** + * Creates or finds a VulnerabilityAssessmentScanState from its string representation. + * + * @param name a name to look for. + * @return the corresponding VulnerabilityAssessmentScanState. + */ + @JsonCreator + public static VulnerabilityAssessmentScanState fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanState.class); + } + + /** @return known VulnerabilityAssessmentScanState values. */ + public static Collection values() { + return values(VulnerabilityAssessmentScanState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanTriggerType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanTriggerType.java new file mode 100644 index 0000000000000..317d4784d4136 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanTriggerType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VulnerabilityAssessmentScanTriggerType. */ +public final class VulnerabilityAssessmentScanTriggerType + extends ExpandableStringEnum { + /** Static value OnDemand for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType ON_DEMAND = fromString("OnDemand"); + + /** Static value Recurring for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType RECURRING = fromString("Recurring"); + + /** + * Creates or finds a VulnerabilityAssessmentScanTriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding VulnerabilityAssessmentScanTriggerType. + */ + @JsonCreator + public static VulnerabilityAssessmentScanTriggerType fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanTriggerType.class); + } + + /** @return known VulnerabilityAssessmentScanTriggerType values. */ + public static Collection values() { + return values(VulnerabilityAssessmentScanTriggerType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifier.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifier.java new file mode 100644 index 0000000000000..0a3a42db3743d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifier.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; + +/** An immutable client-side representation of WorkloadClassifier. */ +public interface WorkloadClassifier { + /** + * 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 memberName property: The workload classifier member name. + * + * @return the memberName value. + */ + String memberName(); + + /** + * Gets the label property: The workload classifier label. + * + * @return the label value. + */ + String label(); + + /** + * Gets the context property: The workload classifier context. + * + * @return the context value. + */ + String context(); + + /** + * Gets the startTime property: The workload classifier start time for classification. + * + * @return the startTime value. + */ + String startTime(); + + /** + * Gets the endTime property: The workload classifier end time for classification. + * + * @return the endTime value. + */ + String endTime(); + + /** + * Gets the importance property: The workload classifier importance. + * + * @return the importance value. + */ + String importance(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner object. + * + * @return the inner object. + */ + WorkloadClassifierInner innerModel(); + + /** The entirety of the WorkloadClassifier definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The WorkloadClassifier definition stages. */ + interface DefinitionStages { + /** The first stage of the WorkloadClassifier definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the WorkloadClassifier definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, workloadGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @return the next definition stage. + */ + WithCreate withExistingWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + } + /** + * The stage of the WorkloadClassifier 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.WithMemberName, + DefinitionStages.WithLabel, + DefinitionStages.WithContext, + DefinitionStages.WithStartTime, + DefinitionStages.WithEndTime, + DefinitionStages.WithImportance { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkloadClassifier create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkloadClassifier create(Context context); + } + /** The stage of the WorkloadClassifier definition allowing to specify memberName. */ + interface WithMemberName { + /** + * Specifies the memberName property: The workload classifier member name.. + * + * @param memberName The workload classifier member name. + * @return the next definition stage. + */ + WithCreate withMemberName(String memberName); + } + /** The stage of the WorkloadClassifier definition allowing to specify label. */ + interface WithLabel { + /** + * Specifies the label property: The workload classifier label.. + * + * @param label The workload classifier label. + * @return the next definition stage. + */ + WithCreate withLabel(String label); + } + /** The stage of the WorkloadClassifier definition allowing to specify context. */ + interface WithContext { + /** + * Specifies the context property: The workload classifier context.. + * + * @param context The workload classifier context. + * @return the next definition stage. + */ + WithCreate withContext(String context); + } + /** The stage of the WorkloadClassifier definition allowing to specify startTime. */ + interface WithStartTime { + /** + * Specifies the startTime property: The workload classifier start time for classification.. + * + * @param startTime The workload classifier start time for classification. + * @return the next definition stage. + */ + WithCreate withStartTime(String startTime); + } + /** The stage of the WorkloadClassifier definition allowing to specify endTime. */ + interface WithEndTime { + /** + * Specifies the endTime property: The workload classifier end time for classification.. + * + * @param endTime The workload classifier end time for classification. + * @return the next definition stage. + */ + WithCreate withEndTime(String endTime); + } + /** The stage of the WorkloadClassifier definition allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload classifier importance.. + * + * @param importance The workload classifier importance. + * @return the next definition stage. + */ + WithCreate withImportance(String importance); + } + } + /** + * Begins update for the WorkloadClassifier resource. + * + * @return the stage of resource update. + */ + WorkloadClassifier.Update update(); + + /** The template for WorkloadClassifier update. */ + interface Update + extends UpdateStages.WithMemberName, + UpdateStages.WithLabel, + UpdateStages.WithContext, + UpdateStages.WithStartTime, + UpdateStages.WithEndTime, + UpdateStages.WithImportance { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkloadClassifier apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkloadClassifier apply(Context context); + } + /** The WorkloadClassifier update stages. */ + interface UpdateStages { + /** The stage of the WorkloadClassifier update allowing to specify memberName. */ + interface WithMemberName { + /** + * Specifies the memberName property: The workload classifier member name.. + * + * @param memberName The workload classifier member name. + * @return the next definition stage. + */ + Update withMemberName(String memberName); + } + /** The stage of the WorkloadClassifier update allowing to specify label. */ + interface WithLabel { + /** + * Specifies the label property: The workload classifier label.. + * + * @param label The workload classifier label. + * @return the next definition stage. + */ + Update withLabel(String label); + } + /** The stage of the WorkloadClassifier update allowing to specify context. */ + interface WithContext { + /** + * Specifies the context property: The workload classifier context.. + * + * @param context The workload classifier context. + * @return the next definition stage. + */ + Update withContext(String context); + } + /** The stage of the WorkloadClassifier update allowing to specify startTime. */ + interface WithStartTime { + /** + * Specifies the startTime property: The workload classifier start time for classification.. + * + * @param startTime The workload classifier start time for classification. + * @return the next definition stage. + */ + Update withStartTime(String startTime); + } + /** The stage of the WorkloadClassifier update allowing to specify endTime. */ + interface WithEndTime { + /** + * Specifies the endTime property: The workload classifier end time for classification.. + * + * @param endTime The workload classifier end time for classification. + * @return the next definition stage. + */ + Update withEndTime(String endTime); + } + /** The stage of the WorkloadClassifier update allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload classifier importance.. + * + * @param importance The workload classifier importance. + * @return the next definition stage. + */ + Update withImportance(String importance); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkloadClassifier refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkloadClassifier refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.java new file mode 100644 index 0000000000000..66d9d0a77566a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of workload classifiers for a workload group. */ +@Immutable +public final class WorkloadClassifierListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkloadClassifierListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifiers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifiers.java new file mode 100644 index 0000000000000..2c0a9c042aabe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifiers.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 WorkloadClassifiers. */ +public interface WorkloadClassifiers { + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @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 workload classifier. + */ + WorkloadClassifier get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @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 workload classifier. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @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 serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Gets the list of workload classifiers for a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload classifiers for a workload group. + */ + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets a workload classifier. + * + * @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 workload classifier. + */ + WorkloadClassifier getById(String id); + + /** + * Gets a workload classifier. + * + * @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 workload classifier. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workload classifier. + * + * @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 workload classifier. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkloadClassifier resource. + * + * @param name resource name. + * @return the first stage of the new WorkloadClassifier definition. + */ + WorkloadClassifier.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroup.java new file mode 100644 index 0000000000000..861de46464fa1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroup.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; + +/** An immutable client-side representation of WorkloadGroup. */ +public interface WorkloadGroup { + /** + * 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 minResourcePercent property: The workload group minimum percentage resource. + * + * @return the minResourcePercent value. + */ + Integer minResourcePercent(); + + /** + * Gets the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + Integer maxResourcePercent(); + + /** + * Gets the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @return the minResourcePercentPerRequest value. + */ + Double minResourcePercentPerRequest(); + + /** + * Gets the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @return the maxResourcePercentPerRequest value. + */ + Double maxResourcePercentPerRequest(); + + /** + * Gets the importance property: The workload group importance level. + * + * @return the importance value. + */ + String importance(); + + /** + * Gets the queryExecutionTimeout property: The workload group query execution timeout. + * + * @return the queryExecutionTimeout value. + */ + Integer queryExecutionTimeout(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner object. + * + * @return the inner object. + */ + WorkloadGroupInner innerModel(); + + /** The entirety of the WorkloadGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The WorkloadGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the WorkloadGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the WorkloadGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the WorkloadGroup 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.WithMinResourcePercent, + DefinitionStages.WithMaxResourcePercent, + DefinitionStages.WithMinResourcePercentPerRequest, + DefinitionStages.WithMaxResourcePercentPerRequest, + DefinitionStages.WithImportance, + DefinitionStages.WithQueryExecutionTimeout { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkloadGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkloadGroup create(Context context); + } + /** The stage of the WorkloadGroup definition allowing to specify minResourcePercent. */ + interface WithMinResourcePercent { + /** + * Specifies the minResourcePercent property: The workload group minimum percentage resource.. + * + * @param minResourcePercent The workload group minimum percentage resource. + * @return the next definition stage. + */ + WithCreate withMinResourcePercent(Integer minResourcePercent); + } + /** The stage of the WorkloadGroup definition allowing to specify maxResourcePercent. */ + interface WithMaxResourcePercent { + /** + * Specifies the maxResourcePercent property: The workload group cap percentage resource.. + * + * @param maxResourcePercent The workload group cap percentage resource. + * @return the next definition stage. + */ + WithCreate withMaxResourcePercent(Integer maxResourcePercent); + } + /** The stage of the WorkloadGroup definition allowing to specify minResourcePercentPerRequest. */ + interface WithMinResourcePercentPerRequest { + /** + * Specifies the minResourcePercentPerRequest property: The workload group request minimum grant + * percentage.. + * + * @param minResourcePercentPerRequest The workload group request minimum grant percentage. + * @return the next definition stage. + */ + WithCreate withMinResourcePercentPerRequest(Double minResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup definition allowing to specify maxResourcePercentPerRequest. */ + interface WithMaxResourcePercentPerRequest { + /** + * Specifies the maxResourcePercentPerRequest property: The workload group request maximum grant + * percentage.. + * + * @param maxResourcePercentPerRequest The workload group request maximum grant percentage. + * @return the next definition stage. + */ + WithCreate withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup definition allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload group importance level.. + * + * @param importance The workload group importance level. + * @return the next definition stage. + */ + WithCreate withImportance(String importance); + } + /** The stage of the WorkloadGroup definition allowing to specify queryExecutionTimeout. */ + interface WithQueryExecutionTimeout { + /** + * Specifies the queryExecutionTimeout property: The workload group query execution timeout.. + * + * @param queryExecutionTimeout The workload group query execution timeout. + * @return the next definition stage. + */ + WithCreate withQueryExecutionTimeout(Integer queryExecutionTimeout); + } + } + /** + * Begins update for the WorkloadGroup resource. + * + * @return the stage of resource update. + */ + WorkloadGroup.Update update(); + + /** The template for WorkloadGroup update. */ + interface Update + extends UpdateStages.WithMinResourcePercent, + UpdateStages.WithMaxResourcePercent, + UpdateStages.WithMinResourcePercentPerRequest, + UpdateStages.WithMaxResourcePercentPerRequest, + UpdateStages.WithImportance, + UpdateStages.WithQueryExecutionTimeout { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkloadGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkloadGroup apply(Context context); + } + /** The WorkloadGroup update stages. */ + interface UpdateStages { + /** The stage of the WorkloadGroup update allowing to specify minResourcePercent. */ + interface WithMinResourcePercent { + /** + * Specifies the minResourcePercent property: The workload group minimum percentage resource.. + * + * @param minResourcePercent The workload group minimum percentage resource. + * @return the next definition stage. + */ + Update withMinResourcePercent(Integer minResourcePercent); + } + /** The stage of the WorkloadGroup update allowing to specify maxResourcePercent. */ + interface WithMaxResourcePercent { + /** + * Specifies the maxResourcePercent property: The workload group cap percentage resource.. + * + * @param maxResourcePercent The workload group cap percentage resource. + * @return the next definition stage. + */ + Update withMaxResourcePercent(Integer maxResourcePercent); + } + /** The stage of the WorkloadGroup update allowing to specify minResourcePercentPerRequest. */ + interface WithMinResourcePercentPerRequest { + /** + * Specifies the minResourcePercentPerRequest property: The workload group request minimum grant + * percentage.. + * + * @param minResourcePercentPerRequest The workload group request minimum grant percentage. + * @return the next definition stage. + */ + Update withMinResourcePercentPerRequest(Double minResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup update allowing to specify maxResourcePercentPerRequest. */ + interface WithMaxResourcePercentPerRequest { + /** + * Specifies the maxResourcePercentPerRequest property: The workload group request maximum grant + * percentage.. + * + * @param maxResourcePercentPerRequest The workload group request maximum grant percentage. + * @return the next definition stage. + */ + Update withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup update allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload group importance level.. + * + * @param importance The workload group importance level. + * @return the next definition stage. + */ + Update withImportance(String importance); + } + /** The stage of the WorkloadGroup update allowing to specify queryExecutionTimeout. */ + interface WithQueryExecutionTimeout { + /** + * Specifies the queryExecutionTimeout property: The workload group query execution timeout.. + * + * @param queryExecutionTimeout The workload group query execution timeout. + * @return the next definition stage. + */ + Update withQueryExecutionTimeout(Integer queryExecutionTimeout); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkloadGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkloadGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.java new file mode 100644 index 0000000000000..21a1f63cdc8f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.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.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of workload groups. */ +@Immutable +public final class WorkloadGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkloadGroupListResult.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/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroups.java new file mode 100644 index 0000000000000..27f8805d18a3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroups.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.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 WorkloadGroups. */ +public interface WorkloadGroups { + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + WorkloadGroup get(String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Gets a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @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 serverName, String databaseName, String workloadGroupName); + + /** + * Deletes a workload group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the list of workload groups. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a workload group. + * + * @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 workload group. + */ + WorkloadGroup getById(String id); + + /** + * Gets a workload group. + * + * @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 workload group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workload group. + * + * @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 workload group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkloadGroup resource. + * + * @param name resource name. + * @return the first stage of the new WorkloadGroup definition. + */ + WorkloadGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/package-info.java new file mode 100644 index 0000000000000..fb71684b644c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/package-info.java @@ -0,0 +1,10 @@ +// 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 SqlManagementClient. The Azure SQL Database management API provides a RESTful + * set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to + * create, retrieve, update, and delete databases. + */ +package com.azure.resourcemanager.sql.generated.models; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/package-info.java new file mode 100644 index 0000000000000..fa68b1391785b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/package-info.java @@ -0,0 +1,10 @@ +// 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 SqlManagementClient. The Azure SQL Database management API provides a RESTful set + * of web services that interact with Azure SQL Database services to manage your databases. The API enables you to + * create, retrieve, update, and delete databases. + */ +package com.azure.resourcemanager.sql.generated; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/module-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..509be326e0f38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/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.sql.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.sql.generated; + exports com.azure.resourcemanager.sql.generated.fluent; + exports com.azure.resourcemanager.sql.generated.fluent.models; + exports com.azure.resourcemanager.sql.generated.models; + + opens com.azure.resourcemanager.sql.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.sql.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/sql/ci.yml b/sdk/sql/ci.yml new file mode 100644 index 0000000000000..07e9938d2090e --- /dev/null +++ b/sdk/sql/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/sql/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sql/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: sql + Artifacts: + - name: azure-resourcemanager-sql-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersqlgenerated diff --git a/sdk/sql/pom.xml b/sdk/sql/pom.xml new file mode 100644 index 0000000000000..0f1d867b2f1bb --- /dev/null +++ b/sdk/sql/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-sql-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-sql-generated + + + +